Skip to content

feat(js): register canvas elements in standalone session via specialHTMTargets#46

Open
jspanchu wants to merge 1 commit into
mainfrom
feat/specialHTMLTargets-standalone-session
Open

feat(js): register canvas elements in standalone session via specialHTMTargets#46
jspanchu wants to merge 1 commit into
mainfrom
feat/specialHTMLTargets-standalone-session

Conversation

@jspanchu

Copy link
Copy Markdown
Member

Enables canvas without id in standalone sessions

  1. Add StandaloneSession.registerCanvas(key, canvas) so callers can bind a canvas element directly — without requiring a DOM id — using Emscripten's specialHTMLTargets map. The key (must start with !) is then passed as canvasSelector to vtkRenderWindow/vtkRenderWindowInteractor.
  2. For the annotation auto-load path, vtkwasm.session is now exported alongside vtkwasm.ready so session.registerCanvas() is reachable after awaiting ready.
  3. Requires https://gitlab.kitware.com/vtk/vtk/-/merge_requests/13345 for specialHTMLTargets to be present in the VTK.wasm binary.

…TMLTargets

Add `StandaloneSession.registerCanvas(key, canvas)` so callers can bind a
canvas element directly — without requiring a DOM `id` — using Emscripten's
`specialHTMLTargets` map. The key (must start with `!`) is then passed as
`canvasSelector` to `vtkRenderWindow`/`vtkRenderWindowInteractor`.

For the annotation auto-load path, `vtkwasm.session` is now exported alongside
`vtkwasm.ready` so `session.registerCanvas()` is reachable after awaiting ready.

Requires https://gitlab.kitware.com/vtk/vtk/-/merge_requests/13345 for
`specialHTMLTargets` to be present in the VTK.wasm binary.
@jspanchu jspanchu requested a review from jourdain June 19, 2026 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants