mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
Make translate-coords parametrizable with operation.
This commit is contained in:
parent
f4ba1f4fdb
commit
d73781f51c
1 changed files with 6 additions and 4 deletions
|
@ -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…
Add table
Reference in a new issue