mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 09:42:01 +00:00
📎 Compare both variants' child turns in one frame in the switch model
The switch model carries an authored geometry value only where both variants agree on it. It compared the new main's child turned into the new copy parent's orientation with the old main's child unturned, so under a turned copy the variants seemed to disagree on rotation and the model dropped the turn the copy's child authors. Both are now turned into their copy parent's orientation. Harness only; the benchmark is not run. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
b6816ffff2
commit
fdfa75074c
@ -751,10 +751,14 @@
|
||||
(placed-flips main (get after (:parent-id main)) new-parent))
|
||||
(and (not root?) (= :geometry-group group) new-parent)
|
||||
(in-orientation (get after (:parent-id main)) new-parent))
|
||||
;; the old main as the old copy showed it, in the
|
||||
;; same frame as `placed`
|
||||
old-placed (cond-> old-main
|
||||
(and root? (= :geometry-group group))
|
||||
(merge {:rotation old-placed-rotation}
|
||||
(placed-flips old-main (get before (:parent-id old-main)) old-parent)))
|
||||
(placed-flips old-main (get before (:parent-id old-main)) old-parent))
|
||||
(and (not root?) (= :geometry-group group) old-main old-parent)
|
||||
(in-orientation (get before (:parent-id old-main)) old-parent))
|
||||
old (if (= :geometry-group group) old-resized old)
|
||||
orientation #{:rotation :flip-x :flip-y}
|
||||
;; the head's turn and flips carry as one: only where the
|
||||
|
||||
@ -1945,6 +1945,17 @@
|
||||
[:swap 12 0 0 0] [:make-variant 4] [:switch 9] [:switch 16 0 0 0]
|
||||
[:combine 7] [:switch 11]]}))))
|
||||
|
||||
(t/deftest switching-a-turned-copy-keeps-the-turn-its-child-authors
|
||||
(t/is (map? (cg/run {:world [2 0 {:variants true :text-styles true :library-variants true :stale-libraries true
|
||||
:layout :flex :layout-item-margins false :grid-square false :library-depth 1
|
||||
:library true :rich-variants true :layout-children true :library-text true
|
||||
:grid-empty false :layout-copies true :text true}]
|
||||
:ops [[:nest 3 0 0 0] [:library-add-child 0] [:library-sync] [:remove-child 5 0 0 0]
|
||||
[:library-delete 2 0 0 0] [:library-combine 10] [:library-sync] [:switch 10]
|
||||
[:library-add-variant 1 0 0 0] [:transform 12 3 0 7] [:library-add-variant 1 0 0 0]
|
||||
[:library-add-variant 0 0 0 0] [:library-transform 0 3 4 0] [:library-add-child 5]
|
||||
[:library-sync] [:library-variant-property 0 0 0 0] [:library-sync] [:switch 10]]}))))
|
||||
|
||||
(t/deftest random-variant-compositions
|
||||
(let [coverage (atom {})
|
||||
failure (atom nil)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user