Skip to content

feat: Pick and highlight geometry through the server in client mode - #204

Open
LKasianAnsys wants to merge 10 commits into
fix/client-shared-connectionfrom
feat/geometry-picker-for-client-mode
Open

LKasianAnsys wants to merge 10 commits into
fix/client-shared-connectionfrom
feat/geometry-picker-for-client-mode

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Addresses #192

Summary

Until now, geometry picking has had two separate implementations: client mode picked in WASM and drew the highlight on a narrow canvas overlay, and server mode picked and highlighted on the server. This PR moves client mode onto the server-mode implementation. It also fixes a VTK object id clash between the browser and the server in client mode.

Changes

  • Server-side pick and highlight: The client now asks the server to set and clear the highlight. The server draws it in the shared scene and pushes it as a data-only update.
  • Pixel ratio: The client reports its device pixel ratio (new pixel_scale payload). The highlight then matches server mode in size.
  • Overlay removed: The WASM picking code and the canvas overlay are gone from VtkScene.js, LocalRenderer and LocalScene.
  • Picked actor read: The picked actor is now read with an invoke call (GetActor) instead of a property read.
  • Highlight with edges on: Highlights were hidden behind part faces when edge visibility was on. Parts now get a small polygon offset so the highlight draws in front.
  • Resize guards: The WASM window is no longer resized when the canvas is 0×0 or its size hasn't changed.
  • Object id clash fix: The browser and the server allocate VTK object ids from one counter range. An id the browser allocated itself could be handed out again by the server's next new object, and the deserializer would then apply the server's state to the wrong object. Right after the wasm module loads, and before any other wasm call, RemoteVtkScene now registers one vtkPoints at id 2 ** 30 (then unregisters its state). Registering at an explicit id raises the counter, and it never falls, so every id the browser allocates afterwards lands above the server's range.

Tests Unit and Jest tests are updated or added for the new flow. Tests for the removed WASM picking code are deleted. A new Jest test (RemoteVtkSceneIdFloor) pins that the id registration at 1073741824 is the first wasm call after load.

Manual testing

The client and server rendering modes now share a geometry picking and highlight mechanism. Test in both modes and they should look and behave the same way.

Id clash check (client mode): Load the viewer with the browser console open at the default level. Pick geometry repeatedly, and call scene-modifying APIs such as add_dataset between picks. Expect no crash and no wrong-object updates, and no console warning starting with Error in WebAssembly module or Could not reserve the browser id range.

@github-actions github-actions Bot added test Work associated with testing added enhancement New feature or request labels Nov 3, 2026
@LKasianAnsys
LKasianAnsys added this pull request to stack #197 November 3, 2026 16:57
@LKasianAnsys
LKasianAnsys force-pushed the feat/geometry-picker-for-client-mode branch 3 times, most recently from d97531c to fbff12e Compare November 4, 2026 16:56
@LKasianAnsys
LKasianAnsys force-pushed the feat/geometry-picker-for-client-mode branch 2 times, most recently from 942f749 to 3a5657a Compare November 4, 2026 21:16
@LKasianAnsys
LKasianAnsys force-pushed the feat/geometry-picker-for-client-mode branch from d7ea751 to 272b7b8 Compare November 5, 2026 14:46
@LKasianAnsys LKasianAnsys self-assigned this Nov 5, 2026
@LKasianAnsys
LKasianAnsys force-pushed the feat/geometry-picker-for-client-mode branch from 272b7b8 to affc2d1 Compare November 5, 2026 15:33
@LKasianAnsys
LKasianAnsys marked this pull request as ready for review November 5, 2026 17:03
@LKasianAnsys LKasianAnsys mentioned this pull request Nov 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

added enhancement New feature or request test Work associated with testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants