0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

Reduce allocation on translate-*-frame functions

This commit is contained in:
Andrey Antukh 2023-06-19 19:11:35 +02:00
parent 121188d921
commit 1ddea076e3

View file

@ -22,14 +22,16 @@
;; --- Outer Rect
(defn translate-to-frame
[shape {:keys [x y]}]
(gtr/move shape (gpt/negate (gpt/point x y))) )
[shape frame]
(->> (gpt/point (- (dm/get-prop frame :x))
(- (dm/get-prop frame :y)))
(gtr/move shape)))
(defn translate-from-frame
[shape {:keys [x y]}]
(gtr/move shape (gpt/point x y)) )
[shape frame]
(gtr/move shape (gpt/point (dm/get-prop frame :x)
(dm/get-prop frame :y))))
(defn shape->rect
[shape]