mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
🐛 Carry no switched text content that shows what the new copy shows
A copy text can hold a typography file without a typography id, which the reference rule counts as a typography override. A switch carried it, and merging the overrides then dropped the reference, since no unit the typography sets was carried. The merged content showed the letters and styles of the new copy and differed from it only by nil typography keys, yet the switch wrote it and marked the content group touched with no text group behind it. A text content the switch would carry is now compared with the new copy's by its letters and styles, and one that differs in none is not carried. Benchmark (scripts/bench-components, ms, lower 2.5% quantile): | :world | :baseline | :now | :mean | :ratio | |------------------------------------+-----------+--------+--------+--------| | deepest-edit-through-three-levels | 35.215 | 19.246 | 20.089 | 0.55 | | edit-through-a-chain-of-dependents | 68.931 | 38.107 | 39.639 | 0.55 | | library-update-into-copies | 83.083 | 46.922 | 48.603 | 0.56 | | main-edit-among-many-shapes | 4.837 | 1.958 | 2.141 | 0.4 | | main-edit-into-10-copies | 1.79 | 0.99 | 1.079 | 0.55 | | main-edit-into-100-copies | 15.415 | 9.335 | 9.733 | 0.61 | | main-edit-into-1000-copies | 153.086 | 92.647 | 96.02 | 0.61 | | variant-switch-into-copies | 32.052 | 20.358 | 20.802 | 0.64 | AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
8e53d5f782
commit
58ee5519d3
@ -289,8 +289,15 @@
|
||||
;; If the final attr-value is the actual value, skip. Geometry values
|
||||
;; equal up to float noise are not an override.
|
||||
(if (or skip?
|
||||
(if (contains? #{:points :selrect :width :height :rotation} attr)
|
||||
(cond
|
||||
(contains? #{:points :selrect :width :height :rotation} attr)
|
||||
(gsh/close-attrs? attr attr-val (get current-shape attr))
|
||||
|
||||
;; a text showing the letters and styles of the new copy is no override
|
||||
text-change?
|
||||
(empty? (txt/override-groups (get current-shape attr) attr-val))
|
||||
|
||||
:else
|
||||
(= attr-val (get current-shape attr))))
|
||||
[]
|
||||
(cond-> []
|
||||
|
||||
@ -2072,6 +2072,13 @@
|
||||
:ops [[:combine 8] [:transform 13 4 0 6] [:nest 8] [:make-variant] [:make-variant 7]
|
||||
[:make-variant] [:transform 0 9 0 2] [:combine 9] [:switch 6]]}))))
|
||||
|
||||
(t/deftest switching-a-text-with-a-typography-file-but-no-typography-carries-no-override
|
||||
(t/is (map? (cg/run {:world [1 0 {:variants true :text-styles false :layout :grid :variant-diff false
|
||||
:layout-item-margins false :grid-square false :rich-variants true
|
||||
:layout-children false :grid-empty false :layout-copies false :text false}]
|
||||
:ops [[:text-style 3 8 1] [:text-style 3 1] [:nest] [:switch] [:text-style 0 8 1]
|
||||
[:switch 1]]}))))
|
||||
|
||||
(t/deftest turning-a-flipped-copy-turns-a-child-stored-as-the-other-mirror-turn
|
||||
(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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user