Vector Art: Gruppen und Layers #190

Closed
opened 2026-09-20 19:46:48 +02:00 by meleki · 2 comments
Owner

Folge-Issue aus #129 (Nachtrag: „weiteres Folge-Issue wären dann sogar Gruppen bzw. Layers").

Befund

Nach #129 ist ein Vector-Art-Asset eine flache Liste von Formen, deren Reihenfolge man im Inspector ändert (eins nach vorne / ganz nach vorne / eins nach hinten / ganz nach hinten, dazu Ziehen). Bei vielen Formen wird das unübersichtlich, und mehrere Formen lassen sich nicht gemeinsam bewegen.

Zu bauen (Vorschlag)

  • Gruppen: eine Gruppe trägt Formen und weitere Gruppen, hat einen Namen, lässt sich als Ganzes verschieben, verbergen und sperren; die Liste im Inspector wird zum aufklappbaren Baum.
  • Die Reihenfolge gilt dann innerhalb der Gruppe, die Gruppe selbst hat eine Position im Stapel.
  • Eine Gruppe hat eine eigene Transformation (Verschieben, Drehen, Skalieren), sonst bringt sie wenig.

Offen

  • Sind „Layers" hier etwas anderes als Gruppen (z. B. mit eigener Deckkraft und Sichtbarkeit im Tab)? Vorschlag: eine Sache, Gruppe genannt.
Folge-Issue aus #129 (Nachtrag: „weiteres Folge-Issue wären dann sogar Gruppen bzw. Layers"). ## Befund Nach #129 ist ein Vector-Art-Asset eine **flache** Liste von Formen, deren Reihenfolge man im Inspector ändert (eins nach vorne / ganz nach vorne / eins nach hinten / ganz nach hinten, dazu Ziehen). Bei vielen Formen wird das unübersichtlich, und mehrere Formen lassen sich nicht gemeinsam bewegen. ## Zu bauen (Vorschlag) - **Gruppen**: eine Gruppe trägt Formen und weitere Gruppen, hat einen Namen, lässt sich als Ganzes verschieben, verbergen und sperren; die Liste im Inspector wird zum aufklappbaren Baum. - Die Reihenfolge gilt dann innerhalb der Gruppe, die Gruppe selbst hat eine Position im Stapel. - Eine Gruppe hat eine eigene **Transformation** (Verschieben, Drehen, Skalieren), sonst bringt sie wenig. ## Offen - Sind „Layers" hier etwas anderes als Gruppen (z. B. mit eigener Deckkraft und Sichtbarkeit im Tab)? Vorschlag: eine Sache, Gruppe genannt.
meleki added the new label 2026-09-20 19:46:48 +02:00
admin added this to the Development project 2026-09-20 19:48:04 +02:00
admin added low-priority and removed new labels 2026-09-21 06:14:48 +02:00
admin added the question label 2026-09-21 06:17:33 +02:00
admin moved this to Next in Development on 2026-10-01 16:30:14 +02:00

Eine Gruppe ist eine Gruppe von Formen, eine Gruppe kann auch mehrere Gruppen und Formen haben. In der Shapes-Hierarchie gibt es dann Einrückungen der Gruppe mit Formen und anderen Gruppen und so weiter. Layers sind wie bei Pixel Art eigene Layers wo Shape Hierarchien drinnen stecken. Opacity pro Layer ist nicht notwendig nur Ein-/Ausblenden (Augen Icon).

Eine Gruppe ist eine Gruppe von Formen, eine Gruppe kann auch mehrere Gruppen und Formen haben. In der Shapes-Hierarchie gibt es dann Einrückungen der Gruppe mit Formen und anderen Gruppen und so weiter. Layers sind wie bei Pixel Art eigene Layers wo Shape Hierarchien drinnen stecken. Opacity pro Layer ist nicht notwendig nur Ein-/Ausblenden (Augen Icon).
admin removed the question label 2026-10-01 22:16:58 +02:00
Author
Owner

Done in 2ff3a78, wiki c8a2b3d (Vector Art, Keyboard, Development).

What changes
The shapes of a vector drawing stand on layers now and can be put into groups, as described in the comment above.

  • Layers: the inspector shows a list LAYERS over the shapes, as in pixel art. Every layer has an eye and no opacity. A hidden layer is neither in the tab nor in the picture a sprite wears, and its shapes cannot be pressed in the tab. + adds a layer, ✕ removes it with all on it (the last one stays), a double-click renames, a drag sorts.
  • The layer worked on: one layer is marked. The pen and Add shape draw onto it, and SHAPES lists what is on it. Selecting a shape picks its layer.
  • Groups: Group (or Ctrl+G) puts the selected shapes into a group, Ungroup (or Ctrl+Shift+G) takes it away. A group holds shapes and further groups. In the list it stands over what is in it, the rows one step in per level.
  • Rows: a row is dragged into a group and out of it. At the end of a group, dragging right stays in the group and left leaves it.
  • In the tab: a click on a shape selects its whole outermost group, and a drag moves it as one undo step.
  • Drawings saved before open with all shapes on one layer. No drawing in the old format lies in data/projects at the moment.

Decided here

  • A group has no transformation of its own and cannot be hidden or locked. The first proposal of the issue had that, the comment does not name it. Rotating, scaling and mirroring, for single shapes and for groups, is #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. A click on a shape of the selection keeps the selection. That is what #217 asked for, which is closed with a pointer to here.
  • Shift+click selects like Ctrl+click (asked for after the first report). With Select, Shift pans the view only beside the shapes now, as in the scene view. Before, Shift+drag panned everywhere in the tab, so the click never arrived. The middle button pans anywhere, and with the pen and Paint Shift pans as before.
  • One shape of a group: its row in the list selects it alone, and Ctrl+click or Shift+click in the tab adds or takes out single shapes.
  • 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 in the tab says so.
  • Groups are always shown unfolded.
  • The four order buttons work inside the own group or layer.

Under the hood

  • The model has layers with a tree of shapes and groups instead of a flat shapes array. The rules are pure functions in src/core/model/vectorTree.ts, the commands in vectorArtCommands.ts work on that tree.
  • SortableList takes rows with a depth and drops into a tree. The flat lists of tilemap and pixel art run as before.
  • src/editor/vectorart/activeLayer.ts keeps the layer worked on, grouping.ts what Group and Ungroup take.

Tests (on melektaus-atx)

gate          204 files, 3067 tests, CHECK EXIT 0 (3008 + 59)
e2e 47,48     ALL PASSED - 108 checks
  • The gate ran once more for exactly the committed state, right before the commit.
  • e2e 39,40,47,48 passed with 209 checks before the Shift change, 47,48 with 108 after it. No full run and no smokes. The sum of 1645 (1639 + 6) in README and wiki is reckoned, the CI run for 2ff3a78 measures it and was not waited for.
  • 59 unit tests: 36 in tests/core/vector-tree.test.ts (tree, commands, loading, picture), 23 in tests/editor/vector-layers.test.ts (inspector and tab).
  • Six e2e checks with a real mouse in block 47j: group, the keys, drag a group, drag a row into a group, add a layer, hide a layer. The second shape is added with Shift+click there.
  • The first e2e run after the Shift change was red (four checks in 47j): the unit test had gone around the pan check, only the browser showed it. Fixed, and the unit test goes through it now.
  • Two screenshots looked at (group in the list, hidden layer). Nothing was looked at after the last build.
  • Only unit tested, not in the browser: the row Layer, sorting and removing layers, copying a group, and that Shift+drag beside the shapes still pans.
Counter-check Result
47 in the unit tests for layers and groups all work
3 in the unit tests for Shift+click all work
Browser, pointer offset ignored on a row drop works
Browser, rows not indented works
Browser, keys swapped works
  • The unit counter-checks ran on stein2, not in the container. One did not work at first (the layer worked on in the signature of the list), the test was sharpened.
  • The 1639 before this change are measured (CI run 281 for 393caad is green).
Done in `2ff3a78`, wiki `c8a2b3d` (*Vector Art*, *Keyboard*, *Development*). **What changes** The shapes of a vector drawing stand on layers now and can be put into groups, as described in the comment above. - **Layers:** the inspector shows a list `LAYERS` over the shapes, as in pixel art. Every layer has an eye and no opacity. A hidden layer is neither in the tab nor in the picture a sprite wears, and its shapes cannot be pressed in the tab. `+` adds a layer, `✕` removes it with all on it (the last one stays), a double-click renames, a drag sorts. - **The layer worked on:** one layer is marked. The pen and *Add shape* draw onto it, and `SHAPES` lists what is on it. Selecting a shape picks its layer. - **Groups:** *Group* (or `Ctrl+G`) puts the selected shapes into a group, *Ungroup* (or `Ctrl+Shift+G`) takes it away. A group holds shapes and further groups. In the list it stands over what is in it, the rows one step in per level. - **Rows:** a row is dragged into a group and out of it. At the end of a group, dragging right stays in the group and left leaves it. - **In the tab:** a click on a shape selects its whole outermost group, and a drag moves it as one undo step. - **Drawings saved before** open with all shapes on one layer. No drawing in the old format lies in `data/projects` at the moment. **Decided here** - **A group has no transformation of its own** and cannot be hidden or locked. The first proposal of the issue had that, the comment does not name it. Rotating, scaling and mirroring, for single shapes and for groups, is #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. A click on a shape of the selection keeps the selection. That is what #217 asked for, which is closed with a pointer to here. - **`Shift`+click selects like `Ctrl`+click** (asked for after the first report). With *Select*, `Shift` pans the view only beside the shapes now, as in the scene view. Before, `Shift`+drag panned everywhere in the tab, so the click never arrived. The middle button pans anywhere, and with the pen and *Paint* `Shift` pans as before. - **One shape of a group:** its row in the list selects it alone, and `Ctrl`+click or `Shift`+click in the tab adds or takes out single shapes. - **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 in the tab says so. - **Groups are always shown unfolded.** - **The four order buttons** work inside the own group or layer. **Under the hood** - The model has `layers` with a tree of shapes and groups instead of a flat `shapes` array. The rules are pure functions in `src/core/model/vectorTree.ts`, the commands in `vectorArtCommands.ts` work on that tree. - `SortableList` takes rows with a depth and drops into a tree. The flat lists of tilemap and pixel art run as before. - `src/editor/vectorart/activeLayer.ts` keeps the layer worked on, `grouping.ts` what *Group* and *Ungroup* take. **Tests** (on `melektaus-atx`) ``` gate 204 files, 3067 tests, CHECK EXIT 0 (3008 + 59) e2e 47,48 ALL PASSED - 108 checks ``` - The gate ran once more for exactly the committed state, right before the commit. - e2e `39,40,47,48` passed with 209 checks before the `Shift` change, `47,48` with 108 after it. No full run and no smokes. The sum of 1645 (1639 + 6) in README and wiki is reckoned, the CI run for `2ff3a78` measures it and was not waited for. - 59 unit tests: 36 in `tests/core/vector-tree.test.ts` (tree, commands, loading, picture), 23 in `tests/editor/vector-layers.test.ts` (inspector and tab). - Six e2e checks with a real mouse in block 47j: group, the keys, drag a group, drag a row into a group, add a layer, hide a layer. The second shape is added with `Shift`+click there. - The first e2e run after the `Shift` change was red (four checks in 47j): the unit test had gone around the pan check, only the browser showed it. Fixed, and the unit test goes through it now. - Two screenshots looked at (group in the list, hidden layer). Nothing was looked at after the last build. - **Only unit tested, not in the browser:** the row *Layer*, sorting and removing layers, copying a group, and that `Shift`+drag beside the shapes still pans. | Counter-check | Result | |---|---| | 47 in the unit tests for layers and groups | all work | | 3 in the unit tests for `Shift`+click | all work | | Browser, pointer offset ignored on a row drop | works | | Browser, rows not indented | works | | Browser, keys swapped | works | - The unit counter-checks ran on stein2, not in the container. One did not work at first (the layer worked on in the signature of the list), the test was sharpened. - The 1639 before this change are measured (CI run 281 for `393caad` is green).
admin moved this to Done in Development on 2026-10-01 23:15:45 +02:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: meleki/feuerwerk#190