diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index 7cb2389dbb..3fb2b272b9 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -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) diff --git a/frontend/test/frontend_tests/plugins/context_shapes_test.cljs b/frontend/test/frontend_tests/plugins/context_shapes_test.cljs index 584121eea6..d144e6e41f 100644 --- a/frontend/test/frontend_tests/plugins/context_shapes_test.cljs +++ b/frontend/test/frontend_tests/plugins/context_shapes_test.cljs @@ -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)) diff --git a/plugins/CHANGELOG.md b/plugins/CHANGELOG.md index 0fba42fa05..87024302b6 100644 --- a/plugins/CHANGELOG.md +++ b/plugins/CHANGELOG.md @@ -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) diff --git a/plugins/libs/plugin-types/index.d.ts b/plugins/libs/plugin-types/index.d.ts index fdba681cce..2f37332aab 100644 --- a/plugins/libs/plugin-types/index.d.ts +++ b/plugins/libs/plugin-types/index.d.ts @@ -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. */