mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 12:18:29 +02:00
🐛 Fix set X position from dimensions token (#5685)
This commit is contained in:
parent
b94afe143f
commit
0cf4d4636a
2 changed files with 21 additions and 20 deletions
|
@ -787,30 +787,31 @@
|
||||||
|
|
||||||
(defn update-position
|
(defn update-position
|
||||||
"Move shapes to a new position"
|
"Move shapes to a new position"
|
||||||
[id position]
|
([id position] (update-position id position nil))
|
||||||
(dm/assert! (uuid? id))
|
([id position opts]
|
||||||
|
(dm/assert! (uuid? id))
|
||||||
|
|
||||||
(ptk/reify ::update-position
|
(ptk/reify ::update-position
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state _]
|
(watch [_ state _]
|
||||||
(let [page-id (:current-page-id state)
|
(let [page-id (:current-page-id state)
|
||||||
objects (dsh/lookup-page-objects state page-id)
|
objects (dsh/lookup-page-objects state page-id)
|
||||||
shape (get objects id)
|
shape (get objects id)
|
||||||
|
;; FIXME: performance rect
|
||||||
|
bbox (-> shape :points grc/points->rect)
|
||||||
|
|
||||||
;; FIXME: performance rect
|
cpos (gpt/point (:x bbox) (:y bbox))
|
||||||
bbox (-> shape :points grc/points->rect)
|
pos (gpt/point (or (:x position) (:x bbox))
|
||||||
|
(or (:y position) (:y bbox)))
|
||||||
|
|
||||||
cpos (gpt/point (:x bbox) (:y bbox))
|
delta (gpt/subtract pos cpos)
|
||||||
pos (gpt/point (or (:x position) (:x bbox))
|
|
||||||
(or (:y position) (:y bbox)))
|
|
||||||
|
|
||||||
delta (gpt/subtract pos cpos)
|
modif-tree (dwm/create-modif-tree [id] (ctm/move-modifiers delta))]
|
||||||
|
|
||||||
modif-tree (dwm/create-modif-tree [id] (ctm/move-modifiers delta))]
|
(rx/of (dwm/apply-modifiers {:modifiers modif-tree
|
||||||
|
:ignore-constraints false
|
||||||
(rx/of (dwm/apply-modifiers {:modifiers modif-tree
|
:ignore-touched (:ignore-touched opts)
|
||||||
:ignore-constraints false
|
:ignore-snap-pixel true})))))))
|
||||||
:ignore-snap-pixel true}))))))
|
|
||||||
|
|
||||||
(defn position-shapes
|
(defn position-shapes
|
||||||
[shapes]
|
[shapes]
|
||||||
|
|
|
@ -206,7 +206,7 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
(map #(dwt/update-position % (zipmap attributes (repeat value))) shape-ids)))))
|
(map #(dwt/update-position % (zipmap attributes (repeat value)) {:ignore-touched true}) shape-ids)))))
|
||||||
|
|
||||||
(defn update-layout-sizing-limits [value shape-ids attributes]
|
(defn update-layout-sizing-limits [value shape-ids attributes]
|
||||||
(ptk/reify ::update-layout-sizing-limits
|
(ptk/reify ::update-layout-sizing-limits
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue