📎 Compare bools by their flags and segments in design snapshots

A bool shows its segments. Its transform and the order of its corners
say nothing its flags and segments do not: sync orients its children
from its turn and flips, and fitting it resets its transform. A turned
bool in a flipped board could store a transform that does not mirror,
or its corners in another order, depending on which step last fitted
it. Design snapshots now leave its transform out and take its corners
in any order.

Harness only; the benchmark is not run.

AI-assisted-by: claude-opus-5-5
This commit is contained in:
alonso.torres 2026-11-14 12:39:28 +01:00
parent c86e7b2f3a
commit 77e17922a2
2 changed files with 13 additions and 0 deletions

View File

@ -259,6 +259,11 @@
(as-> snapshot (cond-> (dissoc snapshot :transform :transform-inverse)
(#{:fill :auto} (:layout-item-h-sizing shape)) (dissoc :width)
(#{:fill :auto} (:layout-item-v-sizing shape)) (dissoc :height))))
;; a bool shows its segments; its transform and the order of
;; its corners say nothing its flags and segments do not
(cond-> (= :bool (:type shape))
(-> (dissoc :transform :transform-inverse)
(d/update-when :points geom/ordered-corners)))
;; no fills or strokes show as an empty list or none at all
(update :fills #(or % []))
(update :strokes #(or % []))

View File

@ -4338,3 +4338,11 @@
(t/is (map? (cg/run {:world [2 0 {:variants true :rich-variants true :text true :layout :grid
:layout-copies false :layout-children false}]
:ops [[:duplicate] [:structure 0 4] [:swap 7] [:rotate 11] [:transform 1 11 0 12]]}))))
(t/deftest generated-a-bool-in-a-flipped-board-shows-its-segments
;; a turned bool in a flipped board may store a transform that does not
;; mirror, while its flags and segments show it as its board turns it
(t/is (map? (cg/run {:world [2 1 {:variants true :rich-variants true :text true :layout nil
:layout-copies true :layout-children false}]
:ops [[:remove-child 0 0 0 0] [:add-child 1] [:structure 0 4 0] [:transform 0 16 0 3]
[:rotate 0 0 0 0] [:rotate 1 0 0 0]]}))))