mirror of
https://github.com/penpot/penpot.git
synced 2025-04-04 19:11:20 -05: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
|
||||
"Move shapes to a new position"
|
||||
[id position]
|
||||
(dm/assert! (uuid? id))
|
||||
([id position] (update-position id position nil))
|
||||
([id position opts]
|
||||
(dm/assert! (uuid? id))
|
||||
|
||||
(ptk/reify ::update-position
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
shape (get objects id)
|
||||
(ptk/reify ::update-position
|
||||
ptk/WatchEvent
|
||||
(watch [_ state _]
|
||||
(let [page-id (:current-page-id state)
|
||||
objects (dsh/lookup-page-objects state page-id)
|
||||
shape (get objects id)
|
||||
;; FIXME: performance rect
|
||||
bbox (-> shape :points grc/points->rect)
|
||||
|
||||
;; FIXME: performance rect
|
||||
bbox (-> shape :points grc/points->rect)
|
||||
cpos (gpt/point (:x bbox) (:y bbox))
|
||||
pos (gpt/point (or (:x position) (:x bbox))
|
||||
(or (:y position) (:y bbox)))
|
||||
|
||||
cpos (gpt/point (:x bbox) (:y bbox))
|
||||
pos (gpt/point (or (:x position) (:x bbox))
|
||||
(or (:y position) (:y bbox)))
|
||||
delta (gpt/subtract pos cpos)
|
||||
|
||||
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
|
||||
:ignore-snap-pixel true}))))))
|
||||
(rx/of (dwm/apply-modifiers {:modifiers modif-tree
|
||||
:ignore-constraints false
|
||||
:ignore-touched (:ignore-touched opts)
|
||||
:ignore-snap-pixel true})))))))
|
||||
|
||||
(defn position-shapes
|
||||
[shapes]
|
||||
|
|
|
@ -206,7 +206,7 @@
|
|||
ptk/WatchEvent
|
||||
(watch [_ _ _]
|
||||
(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]
|
||||
(ptk/reify ::update-layout-sizing-limits
|
||||
|
|
Loading…
Add table
Reference in a new issue