mirror of
https://github.com/penpot/penpot.git
synced 2025-04-17 17:24:32 -05:00
🐛 Fix Ci tests for shape proxy in plugin runtime
This commit is contained in:
parent
a33828467f
commit
ba768f8744
2 changed files with 27 additions and 7 deletions
|
@ -859,6 +859,12 @@
|
|||
(rx/of (reorder-selected-layout-child direction))
|
||||
(rx/of (nudge-selected-shapes direction shift?)))))))
|
||||
|
||||
(defn- get-delta [position bbox]
|
||||
(let [cpos (gpt/point (:x bbox) (:y bbox))
|
||||
pos (gpt/point (or (:x position) (:x bbox))
|
||||
(or (:y position) (:y bbox)))]
|
||||
(gpt/subtract pos cpos)))
|
||||
|
||||
(defn- get-relative-delta [position bbox frame]
|
||||
(let [frame-bbox (-> frame :points grc/points->rect)
|
||||
relative-cpos (gpt/subtract (gpt/point (:x bbox) (:y bbox))
|
||||
|
@ -884,7 +890,9 @@
|
|||
;; FIXME: performance rect
|
||||
bbox (-> shape :points grc/points->rect)
|
||||
frame (cfh/get-frame objects shape)
|
||||
delta (get-relative-delta position bbox frame)
|
||||
delta (if (:absolute? options)
|
||||
(get-delta position bbox)
|
||||
(get-relative-delta position bbox frame))
|
||||
modif-tree (dwm/create-modif-tree [id] (ctm/move-modifiers delta))]
|
||||
(rx/of (dwm/apply-modifiers {:modifiers modif-tree
|
||||
:page-id page-id
|
||||
|
|
|
@ -492,7 +492,9 @@
|
|||
(u/display-not-valid :x "Plugin doesn't have 'content:write' permission")
|
||||
|
||||
:else
|
||||
(st/emit! (dw/update-position id {:x value})))))}
|
||||
(st/emit! (dw/update-position id
|
||||
{:x value}
|
||||
{:absolute? true})))))}
|
||||
|
||||
:y
|
||||
{:this true
|
||||
|
@ -508,7 +510,9 @@
|
|||
(u/display-not-valid :y "Plugin doesn't have 'content:write' permission")
|
||||
|
||||
:else
|
||||
(st/emit! (dw/update-position id {:y value})))))}
|
||||
(st/emit! (dw/update-position id
|
||||
{:y value}
|
||||
{:absolute? true})))))}
|
||||
|
||||
:parent
|
||||
{:this true
|
||||
|
@ -542,7 +546,9 @@
|
|||
parent-id (-> self u/proxy->shape :parent-id)
|
||||
parent (u/locate-shape (obj/get self "$file") (obj/get self "$page") parent-id)
|
||||
parent-x (:x parent)]
|
||||
(st/emit! (dw/update-position id {:x (+ parent-x value)})))))}
|
||||
(st/emit! (dw/update-position id
|
||||
{:x (+ parent-x value)}
|
||||
{:absolute? true})))))}
|
||||
|
||||
:parentY
|
||||
{:this true
|
||||
|
@ -567,7 +573,9 @@
|
|||
parent-id (-> self u/proxy->shape :parent-id)
|
||||
parent (u/locate-shape (obj/get self "$file") (obj/get self "$page") parent-id)
|
||||
parent-y (:y parent)]
|
||||
(st/emit! (dw/update-position id {:y (+ parent-y value)})))))}
|
||||
(st/emit! (dw/update-position id
|
||||
{:y (+ parent-y value)}
|
||||
{:absolute? true})))))}
|
||||
|
||||
:boardX
|
||||
{:this true
|
||||
|
@ -592,7 +600,9 @@
|
|||
frame-id (-> self u/proxy->shape :frame-id)
|
||||
frame (u/locate-shape (obj/get self "$file") (obj/get self "$page") frame-id)
|
||||
frame-x (:x frame)]
|
||||
(st/emit! (dw/update-position id {:x (+ frame-x value)})))))}
|
||||
(st/emit! (dw/update-position id
|
||||
{:x (+ frame-x value)}
|
||||
{:absolute? true})))))}
|
||||
|
||||
:boardY
|
||||
{:this true
|
||||
|
@ -617,7 +627,9 @@
|
|||
frame-id (-> self u/proxy->shape :frame-id)
|
||||
frame (u/locate-shape (obj/get self "$file") (obj/get self "$page") frame-id)
|
||||
frame-y (:y frame)]
|
||||
(st/emit! (dw/update-position id {:y (+ frame-y value)})))))}
|
||||
(st/emit! (dw/update-position id
|
||||
{:y (+ frame-y value)}
|
||||
{:absolute? true})))))}
|
||||
|
||||
:width
|
||||
{:this true
|
||||
|
|
Loading…
Add table
Reference in a new issue