mirror of
https://github.com/penpot/penpot.git
synced 2025-05-20 19:46:11 +02:00
⚡ Improved snap-pixel performance
This commit is contained in:
parent
c9dadce12a
commit
9ab922a0fa
1 changed files with 11 additions and 6 deletions
|
@ -356,22 +356,27 @@
|
||||||
[modif-tree shape modifiers]
|
[modif-tree shape modifiers]
|
||||||
|
|
||||||
(let [children (map (d/getf objects) (:shapes shape))
|
(let [children (map (d/getf objects) (:shapes shape))
|
||||||
modifiers (cond-> modifiers snap-pixel? (set-pixel-precision shape))
|
|
||||||
transformed-rect (gsh/transform-selrect (:selrect shape) modifiers)
|
transformed-rect (gsh/transform-selrect (:selrect shape) modifiers)
|
||||||
|
|
||||||
set-child
|
set-child
|
||||||
(fn [modif-tree child]
|
(fn [snap-pixel? modif-tree child]
|
||||||
(let [child-modifiers (gsh/calc-child-modifiers shape child modifiers ignore-constraints transformed-rect)]
|
(let [child-modifiers (gsh/calc-child-modifiers shape child modifiers ignore-constraints transformed-rect)
|
||||||
|
child-modifiers (cond-> child-modifiers snap-pixel? (set-pixel-precision child))]
|
||||||
(cond-> modif-tree
|
(cond-> modif-tree
|
||||||
(not (gsh/empty-modifiers? child-modifiers))
|
(not (gsh/empty-modifiers? child-modifiers))
|
||||||
(set-modifiers-rec child child-modifiers))))
|
(set-modifiers-rec child child-modifiers))))
|
||||||
|
|
||||||
modif-tree
|
modif-tree
|
||||||
(-> modif-tree
|
(-> modif-tree
|
||||||
(assoc-in [(:id shape) :modifiers] modifiers))]
|
(assoc-in [(:id shape) :modifiers] modifiers))
|
||||||
|
|
||||||
(reduce set-child modif-tree children)))]
|
resize-modif?
|
||||||
(set-modifiers-rec modif-tree shape modifiers)))
|
(or (:resize-vector modifiers) (:resize-vector-2 modifiers))]
|
||||||
|
|
||||||
|
(reduce (partial set-child (and snap-pixel? resize-modif?)) modif-tree children)))]
|
||||||
|
|
||||||
|
(let [modifiers (cond-> modifiers snap-pixel? (set-pixel-precision shape))]
|
||||||
|
(set-modifiers-rec modif-tree shape modifiers))))
|
||||||
|
|
||||||
(defn- get-ignore-tree
|
(defn- get-ignore-tree
|
||||||
"Retrieves a map with the flag `ignore-geometry?` given a tree of modifiers"
|
"Retrieves a map with the flag `ignore-geometry?` given a tree of modifiers"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue