Skip to content

Fix editor interactions (ball, lines, snap, right-click) + regression tests - #2

Merged
OliEder merged 2 commits into
mainfrom
claude/app-review-Oy0Ta
May 30, 2026
Merged

OliEder merged 2 commits into
mainfrom
claude/app-review-Oy0Ta

Conversation

@OliEder

@OliEder OliEder commented May 30, 2026

Copy link
Copy Markdown
Contributor

Was

Behebt vier Editor-Bugs, die das gewünschte Verhalten verhinderten, und sichert sie mit Regressionstests ab.

Fixes

  1. Ball-Besitz-Button war funktionslos – das schwebende Menü indizierte das entities-Array mit einem String-Key. Ballbesitz wird jetzt schema-konform über die Ball-Entity modelliert (EditorState.assignBall), inkl. Frame-Deltas und sichtbarer Darstellung.
  2. Linien waren nach dem Zeichnen unselektierbar – selectLine() wurde nie aufgerufen. Neu: Segment-basierter Hittest beim Klick + Highlight, wodurch Eigenschaftspanel und Löschen erreichbar sind.
  3. Snap-Indikator verschwand beim Ziehen (vom Re-Render entfernt) – wird jetzt wieder eingehängt.
  4. Rechtsklick löschte eine Figur sofort – wählt sie jetzt aus und öffnet das Aktionsmenü.

Zusätzlich: nextEntityNr für offense/defense auf 9 begrenzt (Schema-Limit), Aufrufer abgesichert.

Tests

Neue tests/regressions.spec.js mit 7 Tests (einer pro Bugfix + Numbering-Cap). Jeder Test wurde gegen den Vor-Fix-Code als rot und nach den Fixes als grün verifiziert. Gesamte Suite: 27/27 grün.

claude added 2 commits May 29, 2026 21:47
…right-click

- context-menu: ball button indexed the entities array with a string key
  (always undefined) so it did nothing. Possession is now modeled by the
  ball entity's position via EditorState.assignBall (schema-conformant,
  honors frame deltas, visible on the court).
- interaction: lines could be drawn but never re-selected — selectLine()
  was never called. Added segment-based line hit-testing on click plus a
  selected-line highlight overlay so the line properties panel and delete
  are reachable.
- interaction: snap indicator was wiped by the per-move innerHTML re-render;
  re-append it whenever it is detached from the DOM.
- interaction: right-click now selects the entity (opening the action menu)
  instead of deleting it immediately without confirmation.
- editor: cap offense/defense numbering at 9 (schema limit) and guard the
  palette/drop callers against the now-possible null.
Covers the four repaired behaviors plus the numbering cap:
  #1 ball-possession button assigns the ball entity onto the selected
     player (base position and frame deltas)
  #2 drawn lines are selectable by click and deletable
  #3 snap indicator survives the per-move re-render (driven via synthetic
     mouse events for determinism)
  #4 right-click selects an entity instead of deleting it
  + offense/defense numbering stays capped at 9

Each test was verified to fail against the pre-fix code and pass after.
Expose editorState / player / getCurrentTransform on the OCFEditor global
so tests can drive and inspect real app state through the bundle.
@OliEder
OliEder merged commit 2b8beae into main May 30, 2026
3 checks passed
@OliEder
OliEder deleted the claude/app-review-Oy0Ta branch May 30, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants