mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
🐛 Measure a reset head's turn after the mirror of its main's parent
A library turns and flips an outer component; a file that has not accepted it resets a nested head of an unturned copy. The loaded main is turned onto the copy's parent with the angle between the parents, but under a mirror apply-transform negates the rotation before adding the turn: the head and its child got rotation 90 with an identity transform. The angle is now measured against the parent once transformed, as orient-like does. Benchmark (scripts/bench-components, lower quantile in ms): | world | baseline | now | ratio | |------------------------------------+----------+---------+-------| | deepest-edit-through-three-levels | 35.215 | 18.135 | 0.51 | | edit-through-a-chain-of-dependents | 68.931 | 39.807 | 0.58 | | library-update-into-copies | 83.083 | 44.721 | 0.54 | | main-edit-among-many-shapes | 4.837 | 1.972 | 0.41 | | main-edit-into-10-copies | 1.79 | 0.964 | 0.54 | | main-edit-into-100-copies | 15.415 | 9.318 | 0.60 | | main-edit-into-1000-copies | 153.086 | 90.874 | 0.59 | | variant-switch-into-copies | 32.052 | 20.887 | 0.65 | AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
026819056c
commit
bb909e383f
@ -356,7 +356,9 @@
|
||||
(gmt/unit? relative))
|
||||
main-container
|
||||
(let [transform (gmt/transform-in (gsh/shape->center shape-main) relative)
|
||||
angle (- (or (:rotation target) 0) (or (:rotation origin) 0))
|
||||
;; a mirror negates the rotation before the turn adds to it
|
||||
angle (- (or (:rotation target) 0)
|
||||
(or (some-> origin (gsh/apply-transform transform) :rotation) 0))
|
||||
flip (fn [shape key]
|
||||
(cond-> (get shape key)
|
||||
(not= (boolean (get origin key)) (boolean (get target key))) not))
|
||||
|
||||
@ -908,3 +908,12 @@
|
||||
(t/is (map? (cg/run {:world [2 1 {:variants true :text-styles true :library true :rich-variants true
|
||||
:layout-copies true :text true}]
|
||||
:ops [[:swap 6 0 0 0] [:transform 17 3 0 0] [:swap 9 0 0 0] [:edit 0 0 1 1] [:update-main 0]]}))))
|
||||
|
||||
(t/deftest generated-reset-under-a-stale-mirrored-main-keeps-a-consistent-rotation
|
||||
;; the library turns and flips an outer component; a file that has not
|
||||
;; accepted it resets a nested head of an unturned copy, which keeps a
|
||||
;; rotation its transform agrees with
|
||||
(t/is (map? (cg/run {:world [2 1 {:library true :stale-libraries true :library-dependency true :library-text true}]
|
||||
:ops [[:library-transform 2 3 4 0] [:library-delete 0] [:library-sync] [:library-restore 0]
|
||||
[:library-sync] [:library-undo 0 0 0 0] [:library-transform 16 4 4 0]
|
||||
[:edit 17 1 1 :copy-head] [:reset 17]]}))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user