mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
🐛 Author no empty fills when an update main pushes a shape
An update main that adds a copy's new shape to the main makes the differences between the pushed shape and its new reference authored. A pasted shape holds empty fill and stroke lists where its main holds none, so pushing it marked its fills and strokes overridden though nothing shows differently. No fills or strokes and an empty list of them are the same there. Benchmark (bench-components, run alone): | world | baseline | now | mean | ratio | |------------------------------------+----------+---------+---------+-------| | deepest-edit-through-three-levels | 35.215 | 24.875 | 25.599 | 0.71 | | edit-through-a-chain-of-dependents | 68.931 | 47.991 | 52.684 | 0.7 | | library-update-into-copies | 83.083 | 60.901 | 62.895 | 0.73 | | main-edit-among-many-shapes | 4.837 | 3.193 | 3.451 | 0.66 | | main-edit-into-10-copies | 1.79 | 1.199 | 1.252 | 0.67 | | main-edit-into-100-copies | 15.415 | 10.375 | 11.472 | 0.67 | | main-edit-into-1000-copies | 153.086 | 113.348 | 121.731 | 0.74 | | variant-switch-into-copies | 32.052 | 23.113 | 24.522 | 0.72 | AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
5314093548
commit
6cf28d7dbb
@ -1458,6 +1458,13 @@
|
||||
(and main (some #(not= (get shape %) (get main %)) [:constraints-h :constraints-v :fixed-scroll]))
|
||||
(update :touched ctk/set-touched-group :constraints-group))))
|
||||
|
||||
(defn- same-pushed-value?
|
||||
"Whether a pushed shape's `value` of `attr` shows as its reference's
|
||||
`other`: no fills or strokes and an empty list of them look the same."
|
||||
[attr value other]
|
||||
(or (= value other)
|
||||
(and (#{:fills :strokes} attr) (empty? value) (empty? other))))
|
||||
|
||||
(defn- author-pushed-content
|
||||
"Taking a new content reference makes the pushed differences authored.
|
||||
Placement still follows the position, and existing overrides survive."
|
||||
@ -1472,7 +1479,7 @@
|
||||
(not (contains? placement-groups group))
|
||||
(not= attr :position-data)
|
||||
(not (and text? (= attr :content)))
|
||||
(not= (get shape attr) (get reference attr)))
|
||||
(not (same-pushed-value? attr (get shape attr) (get reference attr))))
|
||||
group))))
|
||||
updatable-attrs)
|
||||
text-groups (when text?
|
||||
|
||||
@ -4308,6 +4308,13 @@
|
||||
:grid-empty false :layout-copies false :text true}]
|
||||
:ops [[:switch 11] [:switch 5] [:nest 17] [:add-child 15] [:rotate 15] [:style 12 9 1] [:paste 12]]}))))
|
||||
|
||||
(t/deftest generated-an-update-main-of-a-pasted-swap-authors-no-empty-fills
|
||||
;; a pasted copy holds empty fill and stroke lists where its main holds
|
||||
;; none; pushing it to the main overrides nothing the two show alike
|
||||
(t/is (map? (cg/run {:world [3 2 {:variants true :rich-variants true}]
|
||||
:ops [[:variant-property 0 16 0 0] [:switch 12] [:remove-child 0 0 0 0]
|
||||
[:add-variant 0 0 0 0] [:paste 12 0 0 0] [:update-main 3 0 0 0]]}))))
|
||||
|
||||
(t/deftest generated-an-absolute-fill-board-in-a-grid-keeps-its-size
|
||||
;; a grid board set to fill a grid cell and then made absolute is no longer
|
||||
;; filled by that grid: its layout settles at its size
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user