mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 07:08:29 +02:00
⚡ Improve performance of absolute-move function
This commit is contained in:
parent
1ddea076e3
commit
f6e9c398b0
1 changed files with 8 additions and 3 deletions
|
@ -101,9 +101,14 @@
|
||||||
|
|
||||||
(defn absolute-move
|
(defn absolute-move
|
||||||
"Move the shape to the exactly specified position."
|
"Move the shape to the exactly specified position."
|
||||||
[shape {:keys [x y]}]
|
[shape pos]
|
||||||
(let [dx (- (d/check-num x) (-> shape :selrect :x))
|
(let [x (dm/get-prop pos :x)
|
||||||
dy (- (d/check-num y) (-> shape :selrect :y))]
|
y (dm/get-prop pos :y)
|
||||||
|
sr (dm/get-prop shape selrect)
|
||||||
|
px (dm/get-prop sr :x)
|
||||||
|
py (dm/get-prop sr :y)
|
||||||
|
dx (- (d/check-num x) px)
|
||||||
|
dy (- (d/check-num y) py)]
|
||||||
(move shape (gpt/point dx dy))))
|
(move shape (gpt/point dx dy))))
|
||||||
|
|
||||||
; ---- Geometric operations
|
; ---- Geometric operations
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue