You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow up on the event system introduced in #16 and align pointer coordinates, hit ordering, bubbling, and missed-event behavior with the actual Two.js scene graph.
Known correctness gaps
Hit testing uses top-left Two.js world coordinates, while TwoEvent.point subtracts half the canvas width and height and reports a different coordinate space.
Shapes under different parent groups fall back to event-registration order rather than complete scene-graph draw order.
A Group with handlers but no registered interactive child is tested through the Group bounding rectangle, which can report hits in empty areas.
onPointerMissed currently fires on a missed pointer-up; its relationship to click, pointer-down, and pointer-capture semantics is not defined.
Pointer capture is inferred from the renderer DOM element, but the synthetic Two.js event does not expose a clear capture API.
Two.js now has contains(...) and Group.getShapesAtPoint(...); the React event layer should use the upstream traversal where possible rather than maintain a competing partial ordering model.
Acceptance criteria
Define and document whether event points are renderer, world, parent-local, or target-local coordinates.
Return coordinates consistently for click, wheel, pointer, bubbling, and captured events.
Resolve topmost targets from the complete current Two.js scene order, including nested and reordered groups.
Define and test Group hit behavior for sparse, nested, transparent, invisible, clipped, and masked content.
Define onPointerMissed semantics and test down/up/click/cancel sequences.
Provide a supported pointer-capture pattern for shape dragging.
Keep bubbling and stopPropagation() behavior deterministic.
Add renderer coverage for SVG, Canvas, and WebGL where behavior differs.
Add tests that assert handler calls and event payloads, not only that the renderer element exists.
Summary
Follow up on the event system introduced in #16 and align pointer coordinates, hit ordering, bubbling, and missed-event behavior with the actual Two.js scene graph.
Known correctness gaps
TwoEvent.pointsubtracts half the canvas width and height and reports a different coordinate space.onPointerMissedcurrently fires on a missed pointer-up; its relationship to click, pointer-down, and pointer-capture semantics is not defined.Two.js now has
contains(...)andGroup.getShapesAtPoint(...); the React event layer should use the upstream traversal where possible rather than maintain a competing partial ordering model.Acceptance criteria
onPointerMissedsemantics and test down/up/click/cancel sequences.stopPropagation()behavior deterministic.Related work