Repository navigation
CVML-194: add_overlay_canvas() embedder overlay API - #263
Merged
Merged
Conversation
Embedders get a pointer-free canvas in the image wrapper that ULabel sizes, zoom-syncs, and removes on destroy(). FilterDistance's overlay joins the same overlay list; its behavior is unchanged. CVML-194 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Main released 0.30.0 and 0.30.1, so the overlay canvas API now ships as 0.31.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
elliott-imhoff
marked this pull request as ready for review
October 21, 2026 19:27
- Add IMAGE_FRAME_Z_INDEX, FILTER_DISTANCE_OVERLAY_Z_INDEX and LOADER_Z_INDEX to blobs.js; the loader now stacks above "above_annotations" overlays. - Remove resize_overlay_canvases(): overlay canvases carry imgsz_class, so rezoom()/drag_rezoom() already resize them. Restore the FilterDistance overlay resize call; overlay_canvases tracks embedder canvases only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
TrevorBurgoyne
approved these changes
Oct 21, 2026
TrevorBurgoyne
left a comment
Member
There was a problem hiding this comment.
good to go once tests pass 👍
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.
Warning
🤖 This pull request was prepared in collaboration with AI.
Embedder overlay canvases (CVML-194)
Description
Adds a small public API so an embedder can draw into a canvas that ULabel places and keeps in sync with zoom and pan, without touching ULabel's DOM. Model Registry needs it for CVML-194, which draws composited segmentation rasters under the annotations.
add_overlay_canvas()appends one canvas to the image wrapper (imwrap_id). The canvas has:image_width * px_per_px×image_height * px_per_pximgsz_classpointer-events: noneandimage-rendering: pixelatedinitcompletes or afterdestroy()."below_annotations"(default) stacks the canvas above the image frames and below every subtask canvas."above_annotations"stacks it above the active subtask canvas. Both z-index values are named constants (OVERLAY_BELOW_ANNOTATIONS_Z_INDEX,OVERLAY_ABOVE_ANNOTATIONS_Z_INDEX) insrc/blobs.js, derived fromBACK_Z_INDEX/FRONT_Z_INDEX.imgsz_class, sorezoom()anddrag_rezoom()resize them with the image. ULabel tracks them inoverlay_canvasesforremove_overlay_canvas()anddestroy(). The FilterDistance overlay is unchanged.src/blobs.js. The loader stacks above"above_annotations"overlays.remove_overlay_canvas()detaches a canvas and drops ULabel's reference to it.destroy()removes any remaining canvases and clears the list.swap_frame_image()leaves overlay canvases in place; the caller owns their content.api_spec.mdand types inindex.d.ts. The changelog entry is under[0.31.0].Release / version bump
Version is 0.31.0 in
package.json,package-lock.json, andsrc/version.js. Main has since released 0.30.0 and 0.30.1; this branch merges latest main, and the overlay API changelog entry sits under[0.31.0]. On merge, a maintainer should cut thev0.31.0tag. Model Registry then moves its pin from this branch's commit to the tag.Testing
npm run lint✅npm run build✅npm test522/522 ✅; Playwright overlay, api-behavior, and basic-functionality specs onchromiumandchromium-minified: 68/68 ✅npm run test:both: 522/522 on each build ✅. Addstests/overlay_canvas.test.js(creation, backing/CSS size, layer z-order, unknown layer, before-init/after-destroy throws, resize, removal, destroy cleanup).tests/e2e/overlay-canvas.spec.jsplus the existing zoom specs, onchromiumandchromium-minified: 38/38 ✅. The spec covers:rezoom()and shift+dragdrag_rezoom()swap_frame_image()PR Checklist
package.jsonhas been bumped since last releasepackage.jsonandsrc/version.jsapi_spec.md)changelog.mdBreaking API Changes
None. The change is additive.
filter_distance_overlayis nownullafterdestroy().