Clip the children of an object to an area #260

Closed
opened 2026-09-28 21:14:41 +02:00 by meleki · 2 comments
Owner

Clip the children of an object to a rectangle, so a scrolling list (inventory grid, dialog text, a log) can move smoothly and anything outside the area is cut off.

Motivation: the inventory grid in cbbf160bb7e8 should scroll vertically. Today the engine cannot clip at all, so only row-by-row scrolling with fixed slots is possible.

Planned behavior

  • An object gets a clip area. All children on all levels are drawn only inside it. Nested clip areas intersect.
  • Clicks and hover (On click, Is hovered) do not hit parts that are cut off.
  • The scene view clips the same way as the game, so what you see while editing is what the game shows.
  • Existing projects load unchanged (clipping off).

Open questions

  1. Where does clipping live?
    • a) A switch Clip children on sprites. It clips to the sprite's own box, plus Clip padding (one number, inwards) so the frame of a window stays visible. (proposal: the inventory window sprite just gets the switch, padding = frame width)
    • b) A new object type Clip area with width/height (dashed outline in the editor, invisible in the game) that clips its children.
    • c) Both.
  2. Scene view: clip always, or show the cut-off parts faintly (like Godot) while the object is selected, so you can still find and drag them?
  3. Scrolling input: a new event node On mouse wheel (delta) as part of this issue, so the grid can actually be scrolled with the wheel? (proposal: yes, it is small and the feature is hardly usable without it)
  4. Scroll bar: only the engine feature here, and the inventory gets its scroll bar as sprites in the project graph? Or a ready-made scroll container object? (proposal: engine feature only, no ready-made scroll container)

Not in scope

  • Masks by texture shape (alpha masks).
Clip the children of an object to a rectangle, so a scrolling list (inventory grid, dialog text, a log) can move smoothly and anything outside the area is cut off. Motivation: the inventory grid in `cbbf160bb7e8` should scroll vertically. Today the engine cannot clip at all, so only row-by-row scrolling with fixed slots is possible. ## Planned behavior - An object gets a clip area. All children on all levels are drawn only inside it. Nested clip areas intersect. - Clicks and hover (`On click`, `Is hovered`) do not hit parts that are cut off. - The scene view clips the same way as the game, so what you see while editing is what the game shows. - Existing projects load unchanged (clipping off). ## Open questions 1. **Where does clipping live?** - a) A switch **Clip children** on sprites. It clips to the sprite's own box, plus **Clip padding** (one number, inwards) so the frame of a window stays visible. *(proposal: the inventory window sprite just gets the switch, padding = frame width)* - b) A new object type **Clip area** with width/height (dashed outline in the editor, invisible in the game) that clips its children. - c) Both. 2. **Scene view:** clip always, or show the cut-off parts faintly (like Godot) while the object is selected, so you can still find and drag them? 3. **Scrolling input:** a new event node **On mouse wheel** (delta) as part of this issue, so the grid can actually be scrolled with the wheel? *(proposal: yes, it is small and the feature is hardly usable without it)* 4. **Scroll bar:** only the engine feature here, and the inventory gets its scroll bar as sprites in the project graph? Or a ready-made scroll container object? *(proposal: engine feature only, no ready-made scroll container)* ## Not in scope - Masks by texture shape (alpha masks).
admin added this to the Development project 2026-09-28 21:17:44 +02:00
admin added the question label 2026-09-28 21:18:21 +02:00
admin moved this to Next in Development on 2026-09-28 21:21:34 +02:00

bei 1. nehmen wir variante "b)", restliche Vorschläge passen

bei 1. nehmen wir variante "b)", restliche Vorschläge passen
admin removed the question label 2026-09-29 06:25:36 +02:00
Author
Owner

Umgesetzt in 0c41cb9 und laut deinen Antworten: 1b (eigener Objekttyp), blasser Rest im Scene-View, On mouse wheel mit dabei, kein fertiger Scroll-Container.

Clip area

  • Neuer Objekttyp Clip area mit width und height (Standard 200 x 150). Die Area dreht, skaliert und spiegelt mit ihrem Parent. Breite und Höhe lassen sich mit den Größen-Griffen ziehen.
  • Alles darunter wird auf jeder Ebene nur innerhalb gezeichnet, im Scene-View wie im Spiel. Verschachtelte Areas schneiden auf die Schnittfläche, gedrehte Areas schneiden auch richtig.
  • On click, Is hovered und On mouse wheel treffen den abgeschnittenen Teil nicht, der Scene-View pickt ihn auch nicht.
  • Im Scene-View ist die Area ein gestrichelter Rahmen und nur am Rand greifbar. Das Auge unter Shape blendet ihn aus. Im Spiel ist sie unsichtbar.
  • Ist ein Objekt darunter oder darüber ausgewählt, zeigt der Scene-View den abgeschnittenen Rest mit 30 % Deckkraft, und dort ist er greifbar.
  • Der Properties-Node kennt den Typ Clip area.

On mouse wheel

  • Feuert nach der Regel von On click. delta zählt in Rastungen, positiv ist nach unten, ein Trackpad liefert Bruchteile. Dazu kommen x/y.

Grenzen

  • Den blassen Rest zeigen nur Sprites und Texte. Tilemaps und Partikel werden geschnitten, aber nicht blass gezeigt.
  • Masken nach Texturform gibt es nicht.

Tests

  • ./check.sh: 2773 Tests, CHECK EXIT 0
  • Voller e2e-Lauf lokal: ALL PASSED, 1549 Checks (gemessen)
  • 12 Unit-Tests in tests/core/clip-areas.test.ts, neues e2e-Modul 58 mit 5 Checks und echter Maus bzw. echtem Mausrad
  • Gegenproben: 6 Unit, 3 Browser, alle greifen

Wiki: Concepts, Behaviors, Architecture, Development (c86b7ba).

Umgesetzt in `0c41cb9` und laut deinen Antworten: **1b** (eigener Objekttyp), blasser Rest im Scene-View, `On mouse wheel` mit dabei, kein fertiger Scroll-Container. **Clip area** - Neuer Objekttyp *Clip area* mit `width` und `height` (Standard 200 x 150). Die Area dreht, skaliert und spiegelt mit ihrem Parent. Breite und Höhe lassen sich mit den Größen-Griffen ziehen. - Alles darunter wird auf jeder Ebene nur innerhalb gezeichnet, im Scene-View wie im Spiel. Verschachtelte Areas schneiden auf die Schnittfläche, gedrehte Areas schneiden auch richtig. - `On click`, `Is hovered` und `On mouse wheel` treffen den abgeschnittenen Teil nicht, der Scene-View pickt ihn auch nicht. - Im Scene-View ist die Area ein gestrichelter Rahmen und nur am Rand greifbar. Das Auge unter *Shape* blendet ihn aus. Im Spiel ist sie unsichtbar. - Ist ein Objekt darunter oder darüber ausgewählt, zeigt der Scene-View den abgeschnittenen Rest mit 30 % Deckkraft, und dort ist er greifbar. - Der `Properties`-Node kennt den Typ *Clip area*. **On mouse wheel** - Feuert nach der Regel von `On click`. `delta` zählt in Rastungen, positiv ist nach unten, ein Trackpad liefert Bruchteile. Dazu kommen `x`/`y`. **Grenzen** - Den blassen Rest zeigen nur Sprites und Texte. Tilemaps und Partikel werden geschnitten, aber nicht blass gezeigt. - Masken nach Texturform gibt es nicht. **Tests** - `./check.sh`: 2773 Tests, CHECK EXIT 0 - Voller e2e-Lauf lokal: ALL PASSED, 1549 Checks (gemessen) - 12 Unit-Tests in `tests/core/clip-areas.test.ts`, neues e2e-Modul 58 mit 5 Checks und echter Maus bzw. echtem Mausrad - Gegenproben: 6 Unit, 3 Browser, alle greifen Wiki: *Concepts*, *Behaviors*, *Architecture*, *Development* (`c86b7ba`).
admin moved this to Done in Development on 2026-09-29 07:37:23 +02:00
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: meleki/feuerwerk#260