mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
🐛 Read a bool's orientation from its turn and flips when syncing
A group keeps its transform when it fits its children but clears its flip flags; a bool keeps its flags while fitting it resets its transform. Sync read the orientation of both from their transform, so a bool in a copy whose main was flipped, resized afterwards, looked unflipped, and a full sync unflipped its shapes, apart from the settled file. A bool's orientation now comes from its turn and flips, a group's from its transform. The harness generates resizes of copy bools again. Test: a-copy-bool-and-its-shapes-are-compared-by-their-corners, now reached; group, sync, switch, golden master and generated group and bool tests pass (376). Benchmark (alone): | :world | :baseline | :now | :mean | :ratio | |------------------------------------+-----------+--------+---------+--------| | deepest-edit-through-three-levels | 35.215 | 21.34 | 27.387 | 0.61 | | edit-through-a-chain-of-dependents | 68.931 | 46.931 | 67.865 | 0.68 | | library-update-into-copies | 83.083 | 63.966 | 74.531 | 0.77 | | main-edit-among-many-shapes | 4.837 | 2.42 | 2.623 | 0.5 | | main-edit-into-10-copies | 1.79 | 1.122 | 1.169 | 0.63 | | main-edit-into-100-copies | 15.415 | 10.589 | 11.406 | 0.69 | | main-edit-into-1000-copies | 153.086 | 101.69 | 106.961 | 0.66 | | variant-switch-into-copies | 32.052 | 21.962 | 26.736 | 0.69 | AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
f924b93a82
commit
07384e599e
@ -2554,11 +2554,12 @@
|
||||
plus)))
|
||||
|
||||
(defn- flips
|
||||
"The flips of `shape`: its flags, or for a group or bool, which takes its
|
||||
bounds from its children and keeps no flags, whether its transform
|
||||
mirrors, as a horizontal flip."
|
||||
"The flips of `shape`: its flags, or for a group, which takes its bounds
|
||||
from its children and clears its flags while its transform keeps the
|
||||
mirror, whether its transform mirrors, as a horizontal flip. A bool keeps
|
||||
its flags while fitting it resets its transform."
|
||||
[shape]
|
||||
(if (#{:group :bool} (:type shape))
|
||||
(if (= :group (:type shape))
|
||||
(let [{:keys [a b c d]} (axes-matrix shape)]
|
||||
{:flip-x (neg? (- (* a d) (* b c))) :flip-y false})
|
||||
{:flip-x (boolean (:flip-x shape)) :flip-y (boolean (:flip-y shape))}))
|
||||
@ -2568,7 +2569,11 @@
|
||||
`target`'s; the lengths of the axes are left to constraints. Compose flip
|
||||
flags with the roots, independent of rotation step size."
|
||||
[head target center]
|
||||
(let [head-flips (flips head)
|
||||
(let [;; a bool keeps its turn and flips while fitting it resets its
|
||||
;; transform, so its orientation comes from them
|
||||
head (cond-> head (= :bool (:type head)) (unskewed))
|
||||
target (cond-> target (= :bool (:type target)) (unskewed))
|
||||
head-flips (flips head)
|
||||
target-flips (flips target)
|
||||
flip-x? (not= (:flip-x head-flips) (:flip-x target-flips))
|
||||
flip-y? (not= (:flip-y head-flips) (:flip-y target-flips))]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user