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
{{ message }}
Repository navigation
[Bug] Align pointer events with Two.js coordinates and scene order #34
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.
The scene ordering prerequisite for this issue is now in place via #36 (fixing #29):
JSX sibling order is strictly reconciled to parent.children in document order during layout effects.
Direct mutations and sorts set parent._flagOrder = true, signaling to Two.js that draw order and pointer-event hit testing order should be updated.
Re-ordering and reparenting now work across component trees and across React.memo boundaries via ChildSlotContext.
This unblocks resolving topmost targets and hit testing directly against the authoritative Two.js scene graph (Group.getShapesAtPoint(...) / parent.children).
Activity
jonobr1 commentedon Sep 3, 2026
Foundation Update from #29
The scene ordering prerequisite for this issue is now in place via #36 (fixing #29):
parent.childrenin document order during layout effects.parent._flagOrder = true, signaling to Two.js that draw order and pointer-event hit testing order should be updated.React.memoboundaries viaChildSlotContext.This unblocks resolving topmost targets and hit testing directly against the authoritative Two.js scene graph (
Group.getShapesAtPoint(...)/parent.children).