Repository navigation
Fix Canvas renderer options, SVG loading, and pointer event semantics - #39
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unpainted non-Path objects can intercept events, and imported SVG renderer resources are not fully released.
2 open findings
What changed in this PR
Fixes Canvas options, SVG loading lifecycle, and pointer-event semantics across renderers.
Changes:
- Normalizes renderer aliases and manages mutable/immutable Canvas options.
- Adds abortable SVG loading, shallow imports, ownership cleanup, and stable ordering.
- Reworks coordinates, hit testing, bubbling, pointer capture, and regression coverage.
| File | Description |
|---|---|
lib/Provider.tsx |
Updates Canvas lifecycle and event dispatch. |
lib/Events.ts |
Implements coordinates, hit testing, and capture APIs. |
lib/SVG.tsx |
Reworks SVG loading and ownership. |
lib/useTwoObject.ts |
Preserves registration across callback updates. |
README.md |
Documents updated behavior. |
tests/canvasOptions.test.tsx |
Tests Canvas options. |
tests/eventSemantics.test.tsx |
Tests pointer semantics. |
tests/events.test.tsx |
Updates event utility coverage. |
tests/svgLifecycle.test.tsx |
Tests SVG lifecycle behavior. |
tests/browser/index.html |
Adds browser harness UI. |
tests/browser/regressions.tsx |
Adds real-renderer regression checks. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
5 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Canvas aliases currently fail at construction, SVG loading ignores shallow and leaks lifecycle ownership, and pointer dispatch disagrees with Two.js coordinates and nested scene order. This change fixes all three open bug issues and documents the resulting behavior.
Behavior changes: event.point now uses top-left renderer world coordinates; Group events target the actual leaf; onPointerMissed requires an empty primary down/up sequence. SVG shallow removes only the imported top-level group and its root transforms. Constructor options require a React key remount. Details and dragging examples are in the README.
Validation:
Fixes #8
Fixes #32
Fixes #34