mirror of
https://github.com/penpot/penpot.git
synced 2025-08-02 04:58:32 +02:00
🐛 Synchronize text positions in components
This commit is contained in:
parent
fa00d674eb
commit
d666755159
6 changed files with 84 additions and 18 deletions
|
@ -252,15 +252,23 @@
|
|||
|
||||
shape-delta
|
||||
(when root
|
||||
(gpt/point (- (:x shape) (:x root))
|
||||
(- (:y shape) (:y root))))
|
||||
(gpt/point (- (gsh/left-bound shape) (gsh/left-bound root))
|
||||
(- (gsh/top-bound shape) (gsh/top-bound root))))
|
||||
|
||||
transformed-shape-delta
|
||||
(when transformed-root
|
||||
(gpt/point (- (:x transformed-shape) (:x transformed-root))
|
||||
(- (:y transformed-shape) (:y transformed-root))))
|
||||
(gpt/point (- (gsh/left-bound transformed-shape) (gsh/left-bound transformed-root))
|
||||
(- (gsh/top-bound transformed-shape) (gsh/top-bound transformed-root))))
|
||||
|
||||
ignore-geometry? (= shape-delta transformed-shape-delta)]
|
||||
;; There are cases in that the coordinates change slightly (e.g. when
|
||||
;; rounding to pixel, or when recalculating text positions in different
|
||||
;; zoom levels). To take this into account, we ignore movements smaller
|
||||
;; than 1 pixel.
|
||||
distance (if (and shape-delta transformed-shape-delta)
|
||||
(gpt/distance-vector shape-delta transformed-shape-delta)
|
||||
(gpt/point 0 0))
|
||||
|
||||
ignore-geometry? (and (< (:x distance) 1) (< (:y distance) 1))]
|
||||
|
||||
[root transformed-root ignore-geometry?]))
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@
|
|||
|
||||
(defn- update-text-modifier
|
||||
[{:keys [grow-type id]} node]
|
||||
|
||||
(let [position-data (utp/calc-position-data node)
|
||||
props {:position-data position-data}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue