mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 09:42:01 +00:00
🐛 Reassign the cells of an untouched grid without authoring them
Updating shapes reassigns the cell positions of the grids among them. That reassignment ignored the update's touched options, so a layout reflow, which updates every layout without touching it, marked the cells of a copy grid as its own whenever they moved, as when a copy child switched to a hidden variant left its cell. Each grid reassigns its cells with the touched options of its own update. The model expects a copy grid's direction change to author its cells only when the change itself moves auto items, not when the reflow after it makes a cell manual. Benchmark (scripts/bench-components, ms, lower 2.5% quantile): | world | baseline | now | ratio | |------------------------------------+----------+---------+-------| | deepest-edit-through-three-levels | 35.215 | 21.005 | 0.60 | | edit-through-a-chain-of-dependents | 68.931 | 39.064 | 0.57 | | library-update-into-copies | 83.083 | 48.602 | 0.58 | | main-edit-among-many-shapes | 4.837 | 2.246 | 0.46 | | main-edit-into-10-copies | 1.79 | 0.984 | 0.55 | | main-edit-into-100-copies | 15.415 | 10.081 | 0.65 | | main-edit-into-1000-copies | 153.086 | 100.708 | 0.66 | | variant-switch-into-copies | 32.052 | 20.063 | 0.63 | AI-assisted-by: claude-opus-5-5
This commit is contained in:
parent
0e812b1f5e
commit
babab40c93
@ -132,8 +132,14 @@
|
||||
ids)))
|
||||
changes (cond-> changes
|
||||
(seq grid-ids)
|
||||
(-> (pcb/update-shapes grid-ids ctl/assign-cell-positions {:with-objects? true})
|
||||
(pcb/reorder-grid-children ids))
|
||||
(as-> changes
|
||||
;; a grid the update does not touch reassigns its cells as a consequence
|
||||
(reduce (fn [changes id]
|
||||
(pcb/update-shapes changes [id] ctl/assign-cell-positions
|
||||
{:with-objects? true
|
||||
:ignore-touched (boolean (or (true? (get ignore-tree id)) ignore-touched))}))
|
||||
changes grid-ids)
|
||||
(pcb/reorder-grid-children changes ids))
|
||||
|
||||
(seq hidden-grid-ids)
|
||||
(-> (pcb/update-shapes hidden-grid-ids ctl/assign-cells
|
||||
|
||||
@ -1077,3 +1077,10 @@
|
||||
(t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :variant-diff false :rich-variants true
|
||||
:layout-copies true :text true}]
|
||||
:ops [[:resize 0 0 0 0] [:rotate 1 0 0 0] [:switch 4 0 0 0]]}))))
|
||||
|
||||
(t/deftest generated-reflow-of-a-copy-grid-keeps-its-cells-inherited
|
||||
;; a copy child switched to a hidden variant leaves its grid cell; the
|
||||
;; layout reflow reassigns the copy grid's cells without authoring them
|
||||
(t/is (map? (cg/run {:world [2 2 {:variants true :text-styles true :layout :grid :variant-diff false
|
||||
:rich-variants true :layout-copies true :text true}]
|
||||
:ops [[:nest 6 0 0 0] [:style 8 1 1] [:switch 4 0 0 0]]}))))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user