Skip to content

fix(preview): fit the viewport within both panel dimensions - #878

Merged
nixuuu merged 1 commit into
devfrom
fix/scale-viewport-longest-edge
Nov 16, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/scale-viewport-longest-edge

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 16, 2026

Copy link
Copy Markdown
Member

Change

A tall Browser Preview could extend past the bottom of a wide sidebar because its intermediate container did not constrain the canvas height. Fit mode now measures the available surface and uses the smaller width/height scale, preserving the image proportions and keeping the entire viewport visible when the panel changes size.

The surface reserves space for all four resize handles. Actual-size mode keeps the frame at 1:1 with scroll access to every edge. Updated the automation tools documentation and implementation status.

Fixes: #872

Verification

  • bun run --filter @canopy/web typecheck — passed, no errors or warnings.
  • bun run lint -- apps/web/src/lib/features/preview/AgentPreviewCanvas.svelte — passed.
  • bun run format -- apps/web/src/lib/features/preview/AgentPreviewCanvas.svelte — completed.
  • git diff --check — passed.
  • Manually inspected the real preview component in a browser at desktop and phone panel widths, in light and dark themes, with portrait/landscape frames and a frame smaller than the panel. Confirmed preserved proportions, visible resize handles, and no scrolling in fit mode.
  • Checked live panel resizing, normalized pointer coordinates, keyboard resizing, and scroll access at 1:1. Panel resizing sends no remote viewport resize commands.
  • Copy audit: no UI text changes.

The full repository verification gate remains with GitHub CI.

Measure the preview surface and scale the frame against both available dimensions so resizing the sidebar keeps the entire viewport visible. Reserve space for resize handles and preserve scroll access in actual-size mode.

Fixes: #872
@nixuuu
nixuuu enabled auto-merge (squash) November 16, 2026 17:05
@nixuuu
nixuuu merged commit eb50b35 into dev Nov 16, 2026
15 checks passed
@nixuuu
nixuuu deleted the fix/scale-viewport-longest-edge branch November 16, 2026 17:12
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