mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 09:42:01 +00:00
📎 Follow the moved parent of a copy that updates its main
The requested update-main check compared the absolute points of the copy that pushes its overrides. When that copy sits in a variant and the push changes the bounds of a sibling variant, the set's layout moves the copy's variant, and the copy with it, though the copy keeps its place in its parent. When the copy's parent keeps its size, the check now moves the expected geometry by the parent's displacement. Test: the regression program updating-a-main-from-a-copy-in-a-variant-it-moves-keeps-the-copy-in-place. Full common suite: the 20-program coverage flakes, and a swap property failure in a text switch that the next commit fixes. Harness only; the benchmark is not run. AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
9c5ac8e887
commit
a578321bf4
@ -525,7 +525,17 @@
|
||||
(= group :geometry-group)
|
||||
;; The source copy stays in its own frame. Existing geometry ownership
|
||||
;; and tolerance apply; I4 then checks its placement against the main.
|
||||
(let [attrs (geometry-differences source-objects kept source source)]
|
||||
(let [source-parent (get source-objects (:parent-id source))
|
||||
kept-parent (get objects (:parent-id kept))
|
||||
;; a parent the push only moves, as a layout does a variant, carries the copy along
|
||||
source (cond-> source
|
||||
(and source-parent kept-parent
|
||||
(= (:id source-parent) (:id kept-parent))
|
||||
(mth/close? (:width source-parent) (:width kept-parent) 0.01)
|
||||
(mth/close? (:height source-parent) (:height kept-parent) 0.01))
|
||||
(gsh/move (gpt/subtract (first (:points kept-parent))
|
||||
(first (:points source-parent)))))
|
||||
attrs (geometry-differences source-objects kept source source)]
|
||||
(when (or (seq attrs)
|
||||
(not= (or (:content-scale source) 1) (or (:content-scale kept) 1)))
|
||||
(mismatch id group (shadow/values source group) (shadow/values kept group))))
|
||||
|
||||
@ -1821,6 +1821,13 @@
|
||||
:ops [[:combine 0] [:switch 10] [:text-style 6 0 1] [:text-style 12 8 1]
|
||||
[:edit 3 0 1 1] [:update-main 3]]}))))
|
||||
|
||||
(t/deftest updating-a-main-from-a-copy-in-a-variant-it-moves-keeps-the-copy-in-place
|
||||
(t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :layout nil :variant-diff false
|
||||
:layout-item-margins false :grid-square false :rich-variants true
|
||||
:layout-children false :grid-empty false :layout-copies true :text true}]
|
||||
:ops [[:nest 0 0 0 0] [:rotate 0 0 0 0] [:make-variant 0 0 0 0] [:swap 0 0 0 0]
|
||||
[:duplicate 0 0 0 0] [:text-style 0 0 1] [:update-main 0 0 0 0]]}))))
|
||||
|
||||
(t/deftest random-variant-compositions
|
||||
(let [coverage (atom {})
|
||||
failure (atom nil)]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user