Files
feuerwerk/todo-notes/done/asset-drag-and-drop.md
T
root d7c8d3e579 Measure a deviation against the base, not the innermost template
An instance edit was dropped as soon as its value matched the template
object. With nested containers the template is not what the value falls
back to: the outer container holds an edit for the object below it, and
that one wins. If the inner template happened to carry the same value the
user typed, the edit was thrown away and the value jumped to whatever the
container in between says.

Reported against the Jump-and-Run project: a coin narrowed to 8 inside
"level", then set back to the sprite's own 24 in the scene, snapped back
to 8. Reproduced through the inspector before touching anything.

InstanceTarget now offers `base`: the template with the edits of every
container in between woven in. Everything that judges deviation uses it -
setOverride/setName/setPosition, both Revert commands, and the gold marks
in the inspector. Writing still goes into the real template, which is
where "apply to container" belongs.

`base` is built on every read. Apply writes into the template and then
asks whether the edit still deviates, so a base captured beforehand would
answer for the template as it was - the e2e suite caught exactly that.

Also in here, because it corrects the commit before it: placing an asset
by double-clicking its row is gone, as asked for in asset-doppelklick.md.
Dragging is the only way to place now. That took AssetPanel.place, the
PlacementTarget interface, Editor.placementTarget and the two worldCenter()
methods that existed only to feed it. A double-click on a scene asset still
makes it the active scene.
2026-09-09 13:45:27 +02:00

2.1 KiB

momentan funktioniert das platzieren eines asset in der scene/container per "Place in ..." über das kontextmenü. zukünftig soll es per drag and drop passieren


Umgesetzt (2026-09-09). Drag and Drop ersetzt den Menueintrag vollstaendig — auf deine Ansage hin ist "Place in scene"/"Place in container" aus dem Kontextmenue verschwunden. Doppelklick auf die Zeile platzierte zunaechst weiterhin in die Mitte der Ansicht — auf deine Notiz asset-doppelklick.md hin ist auch das entfernt.

  • Ziehen: die Zeile im Assets-Panel wird nach 4 px Weg zum Drag; ein Ghost mit dem Asset-Namen haengt am Cursor (src/ui/drag.ts). Die ListView erkennt die Geste nur und gibt sie per onDragOut nach aussen ab — sie kennt kein Ziel ausserhalb ihrer selbst.
  • Vorschau: ueber einer Ansicht zeigt ein Umriss die Groesse, die das Objekt haben wird, plus Fadenkreuz auf dem Ursprung. Rot = der Drop wird abgelehnt.
  • Ziel: die Ansicht unter dem Zeiger, nicht der aktive Tab. Scene-Tab → aktive Szene, Container-Tab → offene Vorlage. ContainerCanvas erbt das von SceneViewport.
  • Regel: placementRejection (src/core/model/placement.ts) — dieselbe Funktion, die PlaceAssetCommand ausfuehrt. Die Vorschau kann also nichts versprechen, was der Drop danach verweigert. Heute lehnt sie ab: Szenen und Container, die in sich selbst landen.

Zwei Fallen, die beim Bauen erst sichtbar wurden:

  1. Ein Drag beginnt mit einem Linksklick, und der selektiert die Zeile — der Container-Tab folgte der Selektion und haette sich mitten im Drag auf genau den Container umgeschaltet, der gerade gezogen wird. Das Ziel waere unter dem Zeiger weggerutscht und jeder Drop haette sich selbst verschachtelt. followSelection haelt jetzt still, solange ein Drag laeuft. Vorher schuetzte davor der Rechtsklick, der nicht selektiert; mit Drag&Drop trug das nicht mehr.
  2. Ein Drag endet oft dort, wo die Zielansicht nichts davon mitbekommt (ueber einem anderen Panel, ausserhalb des Canvas). Ohne onDragChange waere die Vorschau stehengeblieben.