Object-Variable: Ziel per Pipette in der Scene View wählen #276

Closed
opened 2026-09-29 18:26:30 +02:00 by meleki · 3 comments
Owner

Aus #258 (vereinbart: „Auswahl per Klick in der Szene (Pipette): später, fürs Erste reicht das Dropdown.“, im Abschluss: „Not done: no eyedropper“).

Befund

  • Eine Object-Variable am platzierten Objekt wählt ihr Ziel über ein Dropdown mit allen Objekten der Szene (objectChoices, src/core/model/objectRefs.ts:55). Angebunden ist es im Inspector (src/editor/inspector/objectSection.ts:245) und im Variables-Tab (src/editor/variables/VariablesEditor.ts:145).
  • In einer Szene mit vielen gleichnamigen Objekten (etwa 100 „Crate“) ist das mühsam, weil sich die Einträge nur durch die Einrückung unterscheiden.

Zu bauen (Vorschlag)

  • Neben dem Dropdown ein Pipetten-Knopf. Danach wählt ein Klick in der Scene View das Ziel. Esc oder Rechtsklick bricht ab, der Cursor zeigt den Modus an.
  • Wählbar ist nur, was auch das Dropdown anbietet (im Container nur Objekte desselben Containers). Ein Klick auf etwas anderes ändert nichts und meldet es als Hinweis.
  • Die Wahl ist ein Undo-Schritt, wie im Dropdown.
  • Gilt für Object-Variablen, Object-Felder in Structs und Object-Items in Listen.
  • Tests: e2e mit echter Maus (Pipette an, Klick auf ein Objekt in der Scene View, Wert im Inspector, Undo), Unit für die Regel „was ist wählbar“.

Offen (mit Vorschlag)

  1. Auch Ziehen aus der Hierarchie auf das Feld? Vorschlag: nicht in diesem Issue.
Aus #258 (vereinbart: „Auswahl per Klick in der Szene (Pipette): später, fürs Erste reicht das Dropdown.“, im Abschluss: „Not done: no eyedropper“). ## Befund - Eine Object-Variable am platzierten Objekt wählt ihr Ziel über ein Dropdown mit allen Objekten der Szene (`objectChoices`, `src/core/model/objectRefs.ts:55`). Angebunden ist es im Inspector (`src/editor/inspector/objectSection.ts:245`) und im Variables-Tab (`src/editor/variables/VariablesEditor.ts:145`). - In einer Szene mit vielen gleichnamigen Objekten (etwa 100 „Crate“) ist das mühsam, weil sich die Einträge nur durch die Einrückung unterscheiden. ## Zu bauen (Vorschlag) - Neben dem Dropdown ein Pipetten-Knopf. Danach wählt ein Klick in der Scene View das Ziel. Esc oder Rechtsklick bricht ab, der Cursor zeigt den Modus an. - Wählbar ist nur, was auch das Dropdown anbietet (im Container nur Objekte desselben Containers). Ein Klick auf etwas anderes ändert nichts und meldet es als Hinweis. - Die Wahl ist ein Undo-Schritt, wie im Dropdown. - Gilt für Object-Variablen, Object-Felder in Structs und Object-Items in Listen. - Tests: e2e mit echter Maus (Pipette an, Klick auf ein Objekt in der Scene View, Wert im Inspector, Undo), Unit für die Regel „was ist wählbar“. ## Offen (mit Vorschlag) 1. **Auch Ziehen aus der Hierarchie auf das Feld?** Vorschlag: nicht in diesem Issue.
meleki added the new label 2026-09-29 18:26:30 +02:00
admin removed the new label 2026-09-29 18:32:23 +02:00
admin added this to the Development project 2026-09-29 18:32:25 +02:00
admin moved this to Next in Development on 2026-09-29 18:32:27 +02:00

wichtig nur: wenn man etwas auswählt (per links klick), soll nicht gleich bestätigt werden. es geht darum, dass man auch objekte dahinter auswählen kann. somit folgt es einfach der selektion logik (klickt man nochmal wird das dahinter ausgewählt, da brauchen wir nichts neu erfinden) - wenn die auswahl passt, muss man bestäigen bzw. den pipetten modus wieder verlassen. lass uns das nochmal genau definieren wie wir das machen.

Ziehen aus der Hierarchie auf das Feld

brauchen wir nicht, auch kein folge issue

wichtig nur: wenn man etwas auswählt (per links klick), soll nicht gleich bestätigt werden. es geht darum, dass man auch objekte dahinter auswählen kann. somit folgt es einfach der selektion logik (klickt man nochmal wird das dahinter ausgewählt, da brauchen wir nichts neu erfinden) - wenn die auswahl passt, muss man bestäigen bzw. den pipetten modus wieder verlassen. lass uns das nochmal genau definieren wie wir das machen. > Ziehen aus der Hierarchie auf das Feld brauchen wir nicht, auch kein folge issue
Author
Owner

Festlegung (abgestimmt am 2026-09-29):

  1. Starten: Neben jedem Object-Dropdown (Variable, Struct-Feld, Listeneintrag) steht ein Pipetten-Knopf. Solange der Modus läuft, ist er hervorgehoben, über der Scene View steht ein Streifen Target for <Objekt>.<Variable>: <Kandidat> [Take] [Cancel], der Cursor ist ein Fadenkreuz.
  2. Kandidat statt Auswahl: Ein Klick wählt nur einen Kandidaten und schreibt noch nichts. Die normale Auswahl bleibt beim Objekt mit der Variable, der Kandidat bekommt einen eigenen Rahmen in anderer Farbe.
  3. Klicken wie bei der Auswahl (pressOn aus src/viewport/pick.ts, mit dem Kandidaten statt der Auswahl): Klick auf den Kandidaten schaltet auf das Objekt dahinter, nach dem hintersten wieder nach vorne. Klick woanders nimmt das oberste Objekt dort. Zu Beginn ist das aktuelle Ziel der Kandidat.
  4. Nur Wählbares zählt: Durchgeschaltet wird nur über das, was das Dropdown anbietet. Liegt unter dem Zeiger nur Unwählbares, bleibt der Kandidat und es kommt ein Hinweis.
  5. Klick ins Leere tut nichts, der Kandidat bleibt. „None“ gibt es weiter im Dropdown.
  6. Übernehmen: Enter oder Take. Ein Undo-Schritt wie beim Dropdown, keiner, wenn der Kandidat schon das Ziel ist.
  7. Abbrechen, ohne zu schreiben: Esc, Cancel, Rechtsklick in der View oder ein zweiter Klick auf den Pipetten-Knopf. Ebenso bei Tab-Wechsel, Auswahl über die Hierarchie, Undo/Redo oder Play.
  8. Aus dem Variables-Tab: Der Knopf wechselt in die Scene View bzw. den Container, in dem das Objekt liegt. Nach Take oder Cancel geht es zurück in den Variables-Tab.
  9. Während der Pipette geht in der View nichts anderes (kein Verschieben, Rahmen, Tilemap-Malen, Gizmo, Kontextmenü). Schwenken und Zoomen bleiben.
  10. Kein Ziehen aus der Hierarchie, kein Folge-Issue.

Tests: Unit für die reine Regel (Durchschalten nur über Wählbares, Start beim aktuellen Ziel, Leere und Unwählbares ändern nichts), e2e mit echter Maus bei zwei übereinanderliegenden Objekten (Klick, Klick, Wert unverändert, Enter, Wert im Inspector, Undo, Esc schreibt nichts) und ein Durchlauf aus einem Listeneintrag im Variables-Tab.

Festlegung (abgestimmt am 2026-09-29): 1. **Starten:** Neben jedem Object-Dropdown (Variable, Struct-Feld, Listeneintrag) steht ein Pipetten-Knopf. Solange der Modus läuft, ist er hervorgehoben, über der Scene View steht ein Streifen `Target for <Objekt>.<Variable>: <Kandidat> [Take] [Cancel]`, der Cursor ist ein Fadenkreuz. 2. **Kandidat statt Auswahl:** Ein Klick wählt nur einen Kandidaten und schreibt noch nichts. Die normale Auswahl bleibt beim Objekt mit der Variable, der Kandidat bekommt einen eigenen Rahmen in anderer Farbe. 3. **Klicken wie bei der Auswahl** (`pressOn` aus `src/viewport/pick.ts`, mit dem Kandidaten statt der Auswahl): Klick auf den Kandidaten schaltet auf das Objekt dahinter, nach dem hintersten wieder nach vorne. Klick woanders nimmt das oberste Objekt dort. Zu Beginn ist das aktuelle Ziel der Kandidat. 4. **Nur Wählbares zählt:** Durchgeschaltet wird nur über das, was das Dropdown anbietet. Liegt unter dem Zeiger nur Unwählbares, bleibt der Kandidat und es kommt ein Hinweis. 5. **Klick ins Leere tut nichts**, der Kandidat bleibt. „None“ gibt es weiter im Dropdown. 6. **Übernehmen:** Enter oder *Take*. Ein Undo-Schritt wie beim Dropdown, keiner, wenn der Kandidat schon das Ziel ist. 7. **Abbrechen, ohne zu schreiben:** Esc, *Cancel*, Rechtsklick in der View oder ein zweiter Klick auf den Pipetten-Knopf. Ebenso bei Tab-Wechsel, Auswahl über die Hierarchie, Undo/Redo oder Play. 8. **Aus dem Variables-Tab:** Der Knopf wechselt in die Scene View bzw. den Container, in dem das Objekt liegt. Nach Take oder Cancel geht es zurück in den Variables-Tab. 9. **Während der Pipette** geht in der View nichts anderes (kein Verschieben, Rahmen, Tilemap-Malen, Gizmo, Kontextmenü). Schwenken und Zoomen bleiben. 10. Kein Ziehen aus der Hierarchie, kein Folge-Issue. Tests: Unit für die reine Regel (Durchschalten nur über Wählbares, Start beim aktuellen Ziel, Leere und Unwählbares ändern nichts), e2e mit echter Maus bei zwei übereinanderliegenden Objekten (Klick, Klick, Wert unverändert, Enter, Wert im Inspector, Undo, Esc schreibt nichts) und ein Durchlauf aus einem Listeneintrag im Variables-Tab.
admin moved this to Done in Development on 2026-09-30 06:31:17 +02:00
Author
Owner

Done in ded71a9, wiki 8460ac6 (Behaviors, Keyboard, Development). Built as agreed in the comment above.

What you get

  • Every object dropdown has an eyedropper button next to it: variables, struct fields and list entries, in the Inspector and in the Variables tab.
  • The button opens the Scene View or the container tab the object lives in. A strip above the view says which field you fill and shows the candidate: Target for <object> · <variable>: <candidate> [Take] [Cancel]. The cursor is a crosshair.
  • A click picks a candidate and writes nothing yet. It gets a cyan frame, the selection stays on the object with the variable.
  • A click on the candidate goes to the object behind it, after the last one back to the front. A click elsewhere takes the topmost object there. Only objects the dropdown offers count. If there is nothing pickable under the pointer, a hint says so and the candidate stays.
  • A click on empty space does nothing, the candidate stays.
  • Take: Enter or Take. One undo step, as with the dropdown, or none if the target does not change.
  • Cancel: Esc, Cancel, a right click in the view or a second click on the eyedropper button. A tab switch, another selection, undo, redo, play and loading a project cancel too. Nothing is written.
  • After Take or Cancel you are back in the tab you started from, the Variables tab included.
  • While the eyedropper runs, the view does not drag, marquee, paint, show handles or open its context menu. Panning and zooming work.

Under the hood

  • pickOn in src/viewport/pick.ts is the click rule. It reuses pressOn from the selection, only with the candidate instead of the selection and filtered to what the dropdown offers.
  • src/editor/objectPick.ts holds a running pick. EditorState owns it and ends it on the events above.
  • The strip is src/editor/viewport/PickStrip.ts, in the scene pane and in the container tab.

Found on the way

  • Started from the Variables tab, the click missed the object. The Scene View is hidden while that tab is open, and the layout skips hidden children. The strip appeared right then, so the view moved down 32 px but kept its old height. Editor.display() now lays that row out again after showing it.

Tests

unit pick, object-pick     27 passed, 13 new
gate (melektaus-atx)       196 files, 2844 tests, CHECK EXIT 0
e2e 57 (melektaus-atx)     ALL PASSED - 12 checks, 5 new (57e to 57g)
  • 57e to 57g use the real mouse on two objects stacked on top of each other: click, click, click on empty space, Enter with undo, Esc, right click and the second button click, and a list entry from the Variables tab with Take.
  • The gate has two more tests than the 13 new ones. They come from tests/ui/svg-icons.test.ts, which checks every icon twice, so the new icon is checked too.
  • Counter-checks work: without the layout fix 57g fails. Picking objects the dropdown does not offer fails 2 tests. Writing on cancel fails 2 more.
  • The e2e total of 1596 is counted (1591 + 5). The CI run for ded71a9 was not waited for.
Done in `ded71a9`, wiki `8460ac6` (*Behaviors*, *Keyboard*, *Development*). Built as agreed in the comment above. **What you get** - Every object dropdown has an eyedropper button next to it: variables, struct fields and list entries, in the Inspector and in the Variables tab. - The button opens the Scene View or the container tab the object lives in. A strip above the view says which field you fill and shows the candidate: `Target for <object> · <variable>: <candidate> [Take] [Cancel]`. The cursor is a crosshair. - A click picks a candidate and writes nothing yet. It gets a cyan frame, the selection stays on the object with the variable. - A click on the candidate goes to the object behind it, after the last one back to the front. A click elsewhere takes the topmost object there. Only objects the dropdown offers count. If there is nothing pickable under the pointer, a hint says so and the candidate stays. - A click on empty space does nothing, the candidate stays. - **Take:** Enter or *Take*. One undo step, as with the dropdown, or none if the target does not change. - **Cancel:** Esc, *Cancel*, a right click in the view or a second click on the eyedropper button. A tab switch, another selection, undo, redo, play and loading a project cancel too. Nothing is written. - After Take or Cancel you are back in the tab you started from, the Variables tab included. - While the eyedropper runs, the view does not drag, marquee, paint, show handles or open its context menu. Panning and zooming work. **Under the hood** - `pickOn` in `src/viewport/pick.ts` is the click rule. It reuses `pressOn` from the selection, only with the candidate instead of the selection and filtered to what the dropdown offers. - `src/editor/objectPick.ts` holds a running pick. `EditorState` owns it and ends it on the events above. - The strip is `src/editor/viewport/PickStrip.ts`, in the scene pane and in the container tab. **Found on the way** - Started from the Variables tab, the click missed the object. The Scene View is hidden while that tab is open, and the layout skips hidden children. The strip appeared right then, so the view moved down 32 px but kept its old height. `Editor.display()` now lays that row out again after showing it. **Tests** ``` unit pick, object-pick 27 passed, 13 new gate (melektaus-atx) 196 files, 2844 tests, CHECK EXIT 0 e2e 57 (melektaus-atx) ALL PASSED - 12 checks, 5 new (57e to 57g) ``` - 57e to 57g use the real mouse on two objects stacked on top of each other: click, click, click on empty space, Enter with undo, Esc, right click and the second button click, and a list entry from the Variables tab with Take. - The gate has two more tests than the 13 new ones. They come from `tests/ui/svg-icons.test.ts`, which checks every icon twice, so the new icon is checked too. - Counter-checks work: without the layout fix 57g fails. Picking objects the dropdown does not offer fails 2 tests. Writing on cancel fails 2 more. - The e2e total of 1596 is counted (1591 + 5). The CI run for `ded71a9` was not waited for.
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: meleki/feuerwerk#276