Skip to content

feat: enhance viewport handling on resize and panel transitions#10

Merged
hugolytics merged 2 commits into
mainfrom
feat/viewport-panel-transition-sync
Mar 12, 2026
Merged

feat: enhance viewport handling on resize and panel transitions#10
hugolytics merged 2 commits into
mainfrom
feat/viewport-panel-transition-sync

Conversation

@hugolytics
Copy link
Copy Markdown
Member

Summary

Two related improvements to how the viewer handles viewport state when the layout changes.

1. Active-step viewport restoration on resize

When a resize event fires and a step is currently active, instead of trying to restore the previous raw pan/zoom values, re-apply the highlight and autoZoom for the current step nodes. This ensures highlighted elements stay properly framed after a resize rather than drifting to stale coordinates.

2. Viewport sync on panel CSS transition end

Adds an onPanelTransitionEnd listener on the panel element that fires onResize when the panel width or min-height CSS transition completes. This ensures the canvas and svg-pan-zoom instance are resized and re-centred after the panel slides open/closed. The listener is registered in mount() and cleaned up in destroy() to avoid leaks.

Files changed

  • src/viewer/viewer.ts - active-step autozoom on resize; onPanelTransitionEnd handler lifecycle
  • tests/viewer.test.ts - tests for current-step focus after resize, and panel transition end
  • examples/vLLM/deployment.html / docs-site/public/examples/vllm/deployment.html - regenerated output

@hugolytics hugolytics merged commit 80ae176 into main Mar 12, 2026
3 checks passed
@hugolytics hugolytics deleted the feat/viewport-panel-transition-sync branch March 12, 2026 12:33
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.

1 participant