mirror of
https://github.com/penpot/penpot.git
synced 2026-06-20 06:12:04 +00:00
🐛 Add fixedWhenScrolling to API (#10218)
This commit is contained in:
parent
b9dfa0c607
commit
68dd8ecdf5
@ -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)
|
||||
|
||||
@ -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))
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
5
plugins/libs/plugin-types/index.d.ts
vendored
5
plugins/libs/plugin-types/index.d.ts
vendored
@ -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.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user