0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-20 11:41:47 -05:00

🐛 Fix object alignment issue

This commit is contained in:
Andrey Antukh 2023-07-14 14:53:48 +02:00 committed by Alonso Torres
parent e78edca5a8
commit a3f347c9fd

View file

@ -6,6 +6,7 @@
(ns app.common.geom.align
(:require
[app.common.geom.point :as gpt]
[app.common.geom.rect :as grc]
[app.common.geom.shapes :as gsh]
[app.common.pages.helpers :refer [get-children]]))
@ -32,9 +33,9 @@
move also all of its recursive children."
[shape rect axis objects]
(let [wrapper-rect (gsh/shapes->rect [shape])
align-pos (calc-align-pos wrapper-rect rect axis)
delta {:x (- (:x align-pos) (:x wrapper-rect))
:y (- (:y align-pos) (:y wrapper-rect))}]
align-pos (calc-align-pos wrapper-rect rect axis)
delta (gpt/point (- (:x align-pos) (:x wrapper-rect))
(- (:y align-pos) (:y wrapper-rect)))]
(recursive-move shape delta objects)))
(defn calc-align-pos