Skip to content

fix(browser): honor renderer zoom for native viewport and input - #165

Merged
howdeploy merged 1 commit into
howdeploy:mainfrom
teo-nex:fix/browser-native-bounds-drift
Oct 26, 2026
Merged

howdeploy merged 1 commit into
howdeploy:mainfrom
teo-nex:fix/browser-native-bounds-drift

Conversation

@teo-nex

@teo-nex teo-nex commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

A non-default View > Zoom leaves the browser's native page shifted and larger than its React card. The renderer reports CSS pixels, but Electron child Views use device-independent pixels. With a persisted zoom level of -0.5 (91.3%), the native page is about 9.5% too large, exposing a detached page over the canvas.

Convert viewport and clip edges using the trusted IPC sender's zoom factor before rounding, and combine renderer zoom with canvas scale for page rendering. Convert native pointer, pan and wheel-anchor coordinates back to renderer CSS pixels; convert renderer wheel origins to native coordinates before hit testing.

The existing Electron smoke now exercises the real sandboxed preload/IPC path at renderer zoom 91.3%, 80%, 100% and 125%, combined with canvas scales 0.5, 1 and 1.4. It checks native bounds, page zoom, pointer coordinates, wheel handoff and the actual React BrowserCard. Before the fix, this regression fails with expected 193×119 bounds versus actual 211×131 at 91.3% renderer zoom and 0.5 canvas scale; it passes after the fix.

Validation on macOS:

  • npm ci with the repository's node-pty patch applied.
  • npm run build.
  • npm run smoke:browser, including CANVASTTY_BROWSER_ZOOM_SMOKE_READY.
  • Full Node test suite: 2226 passed, 26 skipped, 0 failed. Ran with inherited CANVASTTY_* variables removed and a 30-second per-test timeout (node --test --test-concurrency=1 --test-timeout=30000 --test-reporter=tap tests/*.test.mjs).
  • 24 focused viewport, gesture, integration and IPC-security tests also passed.
  • npm run audit:secrets and git diff --check.
  • Visually checked the isolated Electron build at 91.3% zoom: the page stays inside the card.

@howdeploy
howdeploy merged commit 46620e4 into howdeploy:main Oct 26, 2026
3 of 5 checks passed
howdeploy added a commit that referenced this pull request Oct 26, 2026
Integrate #163 by @BIackFIame, #164 by @CLOSETTTY, and #165/#166 by @teo-nex, with separate maintainer integration fixes. Preserve original contributor commits and authorship. Include the already-merged #158 contribution by @pepechka-kun in the release credits. PRs #159 and #160 remain excluded.
BIackFIame added a commit to BIackFIame/CanvasTTY that referenced this pull request Oct 26, 2026
Upstream main 3d50657 (howdeploy#168): howdeploy#163 auto-sort (already in edge, one copy),
howdeploy#164 animated terminal backgrounds and F8 quick hide, howdeploy#165 browser zoom,
howdeploy#166 CanvasLink for Android, maintainer follow-ups, version 1.8.3.

Conflicts kept both sides: changelogs (1.8.3 above edge's 1.8.2 notes),
renderer define for the build commit plus the es worker format, version
1.8.3 with the Edge desktop name, upstream's lockfile (no Edge-only deps),
the Claude/Codex editor keys next to the F8 background toggle (F8 clashes
with every other key, as upstream), plugin names next to the background
types in App, and the Settings keyboard labels.
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