A vector drawing was one flat list of shapes. With many shapes the
list got hard to read, and several shapes could not be kept or moved
together. Now the shapes stand on layers, as in pixel art, and can be
put into groups that nest.
- A drawing has layers, each with a name and an eye. A hidden layer
is neither in the tab nor in the picture a sprite wears, and its
shapes cannot be pressed. One layer is the one worked on: the pen
and Add shape draw onto it, and SHAPES lists what is on it.
- The inspector has a list LAYERS over the shapes. Its plus adds a
layer, the cross on a row removes it with all on it, the last one
stays. A double-click renames, a drag sorts.
- Group (Ctrl+G) puts the selected shapes into a group, Ungroup
(Ctrl+Shift+G) takes it away. A group stands over its rows in the
list, the rows one step in, and a row is dragged into a group or
out of it.
- In the tab a press on a shape takes its outermost group, and a drag
moves the group as one undo step.
- The model has layers with a tree of shapes and groups instead of a
flat shapes array. The rules are pure functions in
core/model/vectorTree.ts. A drawing saved before opens with all its
shapes on one layer.
- SortableList takes rows with a depth and drops into a tree. The
flat lists of tilemap and pixel art run as before.
Decided here:
- A group has no transformation of its own and cannot be hidden or
locked. Rotating and scaling is the follow-up #291.
- A group is never empty: the one that loses its last shape goes
with it.
- Several selected shapes are dragged together, grouped or not, and
a click on a shape of the selection keeps the selection. This is
what #217 asked for.
- Shift+click selects like Ctrl+click. With Select, Shift pans only
beside the shapes, as in the scene view. The middle button pans
anywhere, and with the pen and Paint Shift pans as before.
- A row of the list picks one shape of a group alone.
- Shapes change their layer through a row Layer in the inspector,
which is there from two layers on. Rows are not dragged between
layers.
- A group cannot span two layers, the button is off then.
- The pen does not draw onto a hidden layer, the hint says so.
- Groups are always shown unfolded.
- The four order buttons work inside the own group or layer.
Tests:
- Gate: 204 files, 3067 tests (3008 + 59), exit 0
- e2e 47,48: 108 checks. e2e 39,40,47,48 before the Shift change:
209 checks. No full run, the sum of 1645 (1639 + 6) is reckoned
and CI measures it.
- 59 unit tests: 36 in tests/core/vector-tree.test.ts, 23 in
tests/editor/vector-layers.test.ts
- Six e2e checks with a real mouse in block 47j
- 47 unit counter-probes for layers and groups and three for the
Shift click all fail tests, run on stein2
- Three browser counter-probes fail their checks
- Two screenshots looked at (group in the list, hidden layer)
- Only unit tested: the row Layer, sorting and removing layers,
copying a group, the Shift pan beside the shapes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>