Skip to content

feat: Remote rendering 4.6: Keep view fitted to the canvas on resize - #189

Open
LKasianAnsys wants to merge 4 commits into
feat/4.3c-pick-parts-in-server-modefrom
feat/4.6-fit-view-to-canvas
Open

LKasianAnsys wants to merge 4 commits into
feat/4.3c-pick-parts-in-server-modefrom
feat/4.6-fit-view-to-canvas

Conversation

@LKasianAnsys

@LKasianAnsys LKasianAnsys commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Issue

Resolves #31

Context

Until now, the orthographic view ruler's displayed scale value did not adjust with the canvas in SERVER mode, and the orientation widget did not resize with the canvas in either CLIENT or SERVER mode. In this PR, the ruler on every canvas resize change. The orientation widget is now set to 0.15x the canvas's shorter side in both modes.

Manual check,
In SERVER mode: Start a VISOR session with a dataset and with a unit passed via Metadata. Turn on the orthographic view, and see the ruler. Zoom in and out, and/or resize the canvas window. Notice the scale value updates accordingly.
In SERVER and CLIENT mode: Start a VISOR session with a dataset. Resize the window; the orientation widget scales with the canvas size.

Copilot summary

This pull request introduces improvements to how the orientation widget is sized and kept in sync with the render window during resizes, as well as infrastructure to notify listeners of canvas resizes and propagate those changes through the rendering pipeline. It also adds comprehensive tests to ensure correct resize handling and updates the server and client code to keep the view and camera state consistent after resizes.

Orientation widget sizing and resize propagation:

  • The orientation widget is now automatically fitted to a fraction of the render window's shorter side whenever the window is resized, ensuring consistent appearance and usability. This is achieved by adding a fit_to_window method to VisorOrientationWidget and invoking it during viewport size changes. [1] [2] [3] [4]

Canvas resize event infrastructure:

  • The IServerCanvas interface and its implementation now support addResizeListener, allowing other components to be notified when the canvas is resized to a non-zero size. This infrastructure is used to trigger camera state updates and widget resizing in response to user or system-initiated resizes. [1] [2] [3] [4] [5] [6]

Renderer and camera state updates:

  • The server-side renderer (ServerRenderer) now listens for canvas resize events and updates all camera listeners with the new viewport height, ensuring camera state remains accurate. The viewport height calculation is now truncated to match server-side sizing. [1] [2] [3] [4]

Frontend and widget integration:

  • The orientation widget is now properly managed and resized in the WebAssembly renderer (WasmRenderer), and unused or commented-out code related to orientation widget instantiation in the frontend has been cleaned up. [1] [2] [3] [4] [5]

Testing and validation:

  • New and updated Jest tests verify that resize listeners are called appropriately, camera listeners receive correct viewport heights after resizes, and the orientation widget is resized based on the window's new dimensions. [1] [2] [3] [4] [5] [6] [7] [8]

These changes together provide a robust and extensible mechanism for handling canvas and window resizes, keeping the UI elements and camera state in sync with the underlying render window.

@github-actions github-actions Bot added test Work associated with testing added enhancement New feature or request labels Oct 22, 2026
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch from cff2f15 to 5537068 Compare October 26, 2026 14:17
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch from 5537068 to b56dbbd Compare October 26, 2026 17:33
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch from b56dbbd to d243b28 Compare October 26, 2026 19:45
@LKasianAnsys
LKasianAnsys marked this pull request as ready for review October 26, 2026 20:37
@LKasianAnsys LKasianAnsys linked an issue Oct 26, 2026 that may be closed by this pull request
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch from d243b28 to 9f57271 Compare October 28, 2026 14:10
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch from 9f57271 to fae445b Compare October 28, 2026 16:17
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch from fae445b to 4f3c7ba Compare October 28, 2026 16:31
@LKasianAnsys
LKasianAnsys added this pull request to stack #197 October 29, 2026 20:54
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch 2 times, most recently from fbe0192 to 53bce2c Compare October 29, 2026 21:51
@LKasianAnsys LKasianAnsys changed the title feat: [Remote rendering 4.6] Keep view fitted to the canvas on resize feat: Remote rendering 4.6: Keep view fitted to the canvas on resize Oct 29, 2026
@LKasianAnsys
LKasianAnsys force-pushed the feat/4.6-fit-view-to-canvas branch from 394cb8c to 9ac6f15 Compare October 29, 2026 23:11

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.

[Remote rendering 4.6] Viewport resize in REMOTE mode

4 participants