fix/set-annotations - #253
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a set_annotations() regression where bulk teardown removed the subtask’s front canvas and dialogs container (breaking hover feedback and brush UI), and adds a dedicated demo page to exercise annotation swapping scenarios.
Changes:
- Update bulk teardown to remove only per-annotation canvases (
canvas.annotation_canvas) instead of emptying the entire#canvasses__<subtask>container. - Strengthen the unit test to reflect the init-time DOM structure and assert the front/back canvases + dialogs container survive teardown.
- Bump library version to
0.26.2and add a newset-annotationsdemo + demo URL listing.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/annotation.test.js | Updates teardown test to ensure only per-annotation canvases are removed and critical UI containers remain. |
| src/index.js | Fixes teardown selector to preserve front/back canvases and dialogs container during set_annotations(). |
| src/version.js | Bumps exported version to 0.26.2. |
| package.json | Bumps package version to 0.26.2. |
| package-lock.json | Keeps lockfile version metadata in sync with 0.26.2. |
| demo/set-annotations.html | Adds a new demo page to swap through multiple annotation presets (including bitmask variants). |
| demo.js | Adds the new demo URL to the local demo server output. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
fix/set-annotations
Description
set_annotations()where hover feedback and the brush stopped working after a swap. The 0.26.1 bulk-teardown path called$("#canvasses__<subtask>").empty(), which removed not just the per-annotation canvases but also the subtask's front canvas and the#dialogs__<subtask>container (which owns the brush circle and polygon ender).state.front_contextwas left pointing at a detached canvas so hover highlights painted into nothing, and the brush had no parent to attach to. The teardown now removes only> canvas.annotation_canvaschildren, leaving the front/back canvases and dialogs container intact.demo/set-annotations.htmlwith buttons that swap through empty / small / medium / large / RLE-bitmask / raw-Uint8Array-bitmask presets so this regression stays visible.PR Checklist
package.jsonhas been bumped since last releasepackage.jsonandsrc/version.jsapi_spec.md)changelog.mdBreaking API Changes
No