🐛 Add fixedWhenScrolling to API (#10218)

This commit is contained in:
Alonso Torres 2026-06-18 15:29:47 +02:00 committed by GitHub
parent b9dfa0c607
commit 68dd8ecdf5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 31 additions and 0 deletions

View File

@ -399,6 +399,22 @@
:else
(st/emit! (dwsh/update-shapes [id] #(assoc % :constraints-v value))))))}
:fixedWhenScrolling
{:this true
:get #(-> % u/proxy->shape :fixed-scroll boolean)
:set
(fn [self value]
(cond
(not (boolean? value))
(u/not-valid plugin-id :fixedWhenScrolling value)
(not (r/check-permission plugin-id "content:write"))
(u/not-valid plugin-id :fixedWhenScrolling "Plugin doesn't have 'content:write' permission")
:else
(let [id (obj/get self "$id")]
(st/emit! (dwsh/update-shapes [id] #(assoc % :fixed-scroll value))))))}
:borderRadius
{:this true
:get #(-> % u/proxy->shape :r1)

View File

@ -132,6 +132,15 @@
(t/is (= (.-constraintsVertical shape) "bottom"))
(t/is (= (get-in @store (get-shape-path :constraints-v)) :bottom)))
(t/testing " - fixedWhenScrolling"
(set! (.-fixedWhenScrolling shape) true)
(t/is (= (.-fixedWhenScrolling shape) true))
(t/is (= (get-in @store (get-shape-path :fixed-scroll)) true))
(set! (.-fixedWhenScrolling shape) false)
(t/is (= (.-fixedWhenScrolling shape) false))
(t/is (= (get-in @store (get-shape-path :fixed-scroll)) false)))
(t/testing " - borderRadius"
(set! (.-borderRadius shape) 10)
(t/is (= (.-borderRadius shape) 10))

View File

@ -13,6 +13,7 @@
- **plugin-types**: Added `textBounds` property for text shapes
- **plugin-types**: Added flag `throwValidationErrors` to enable exceptions on validation
- **plugin-types**: Fix missing `webp` export format in `Export.type`
- **plugin-types**: Added `fixedWhenScrolling` property for shapes
## 1.4.2 (2026-01-21)

View File

@ -3669,6 +3669,11 @@ export interface ShapeBase extends PluginData {
*/
constraintsVertical: 'top' | 'bottom' | 'topbottom' | 'center' | 'scale';
/**
* Indicates whether the shape stays fixed in place while scrolling.
*/
fixedWhenScrolling: boolean;
/**
* The border radius of the shape.
*/