mirror of
https://github.com/penpot/penpot.git
synced 2026-04-28 04:38:14 +00:00
Make translate-coords parametrizable with operation.
This commit is contained in:
parent
f4ba1f4fdb
commit
d73781f51c
@ -144,10 +144,12 @@
|
||||
(defn translate-coords
|
||||
"Given a shape and initial coords, transform
|
||||
it mapping its coords to new provided initial coords."
|
||||
[shape x y]
|
||||
(let [x' (:x shape)
|
||||
y' (:y shape)]
|
||||
(assoc shape :x (- x' x) :y (- y' y))))
|
||||
([shape x y]
|
||||
(translate-coords shape x y -))
|
||||
([shape x y op]
|
||||
(let [x' (:x shape)
|
||||
y' (:y shape)]
|
||||
(assoc shape :x (op x' x) :y (op y' y)))))
|
||||
|
||||
(defn resolve-position
|
||||
"Recursively resolve the real shape position in
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user