mirror of
https://github.com/penpot/penpot.git
synced 2026-11-21 01:22:01 +00:00
A variant switch moves a swapped child of the old copy into the new one and gives it the place of the new variant's occupant. The new copy is created at its main's size, so in a copy that a layout had made wider the child kept the size and place the wider parent gave it: a child the user moved, with a right constraint, stayed by the old right edge, and one with a scale constraint kept its grown size, which the layout then scaled again. The child and its subtree now follow the change from the old parent to the new one through their own constraints before taking that place. The switch tests of develop's swapped and moved children placement cover it. Benchmark (scripts/bench-components, ms, lower 2.5% quantile): | world | baseline | now | ratio | |------------------------------------+----------+---------+-------| | deepest-edit-through-three-levels | 35.215 | 21.321 | 0.61 | | edit-through-a-chain-of-dependents | 68.931 | 42.794 | 0.62 | | library-update-into-copies | 83.083 | 50.007 | 0.60 | | main-edit-among-many-shapes | 4.837 | 2.297 | 0.47 | | main-edit-into-10-copies | 1.79 | 1.003 | 0.56 | | main-edit-into-100-copies | 15.415 | 9.732 | 0.63 | | main-edit-into-1000-copies | 153.086 | 98.04 | 0.64 | | variant-switch-into-copies | 32.052 | 20.73 | 0.65 | AI-assisted-by: claude-opus-5-5