fix(tray): scale auto-fit measure by active zoom + clamp proof anchor (#265) - #266
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the two tray-layout bugs from #265 (surfaced by the #261 repro rig).
1.
useTrayPanelLayoutmeasure vs CSSzoomTrayPanel renders the surface with
zoom: trayScale, but every DOM metric the auto-fit pass reads —scrollHeightand bounding rects — is reported in the surface's local, pre-zoom px (measured identical at 100/150/200% in the 261 probes). The WIN32 window was sized to the pre-zoom height, so at >100% tall cards clipped below the fold.scaledContentHeight(rawHeight, zoom)inuseTrayPanelLayout.ts: identity for zoom invalid/≤0/1, elseMath.round(raw * zoom). Applied at both measure derivations — thescrollHeight/rect-height seed and the bottom-edge walk — before the existing[minHeight, maxHeight]clamp. The +4px fudge, clamp semantics, and the 2pxshouldResizethreshold are unchanged.useTrayPanelControllerpasses the already-computedtrayScaleas the hook's newzoomoption;layoutKeyalready includestrayScaleDraft, so zoom changes re-trigger the layout pass..menu-surface'smin-width: 260pxis interpreted in zoom-local px (renders 390px at 150% inside the 328px window → document-level h-scrollbar + right-clipped content). Re-assertedmin-width: 0in the existing cascade-order.menu-surface--trayoverride block (the tray window's own 300px min covers the floor).Test (
TrayPanel.test.tsx, "scales the auto-fit measure by the active tray zoom before clamping (#265)"): pinnedscrollHeight505 attrayScalePercent: 150commits328×762(round(505×1.5)+4); 700 clamps to the mocked work-area cap884. Mutation-checked (fails without scaling).2. Proof-harness anchor overflows work area
The harness anchored the panel once at the default initial size (y=252 on 1920×1080) and never re-anchors; a tall auto-fit settle pushed the bottom edge below the 1040px work bottom. (
set_max_sizewas tried first and is ignored by Win32 for programmaticsetSize.)proof_harness.rs:proof_window_positionnow wraps the raw anchor withproof_anchor_y(anchor, work_bottom, max_settle)=anchor.min(work_bottom - 8 - max_settle), where max settle mirrors the frontend's 920px auto-fit cap. Anchors that already fit are unchanged; overflowing ones move up just enough that even the capped settle's bottom edge stays atwork_bottom - 8.Test (
proof_harness::tests::tall_panel_bottom_edge_never_passes_work_bottom_minus_inset): 252 → justified 112 on the 1080 rig; settled 920 bottoms exactly at 1032; short settles stay on screen; tall-display anchors unchanged.Gates (run against the committed tree in a pristine worktree)
pnpm --dir apps/desktop-tauri exec tsc --noEmitok;pnpm --dir apps/desktop-tauri test— 227 passedcargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml— 332 passed;cargo clippy --all-targets -- -D warningsok;cargo fmt --allokLive CUA verification (150% zoom, seeded tall Codex card)
Tray zoom driven to 150% through the panel footer Zoom slider via CDP (UIA ValuePattern is ignored by WebView2; the slider's real React onChange path was dispatched) — persisted
trayScalePercent: 150confirmed viaget_settings_snapshot, applied CSSzoom: 1.5confirmed. RelaunchedCODEXBAR_PROOF_MODE=trayPanelwithCODEXBAR_SEED_USAGE_JSON(proof-261-seed/full shape, timestamps freshened).Observed (1920×1080, work area 1920×1040):
bodyScrollWidth == clientWidth == 328→ no horizontal overflow/scrollbar; footer (Quit row) fully visible (footer.bottom 841 ≤ innerHeight 920) — the card's bottom content is on screen (previously clipped).proof-265/zoom150-tallcard-fixed.png,proof-265/zoom150-tallcard-fixed-rects.json,proof-265/zoom150-tallcard-fixed-observation.json.Closes #265
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.