Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(canvas): never promote the viewport during a camera move
enesd5102a036ce9
diff --git a/CLAUDE.md b/CLAUDE.mdindex 4e5fad56f..f747dc30e 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -6800,16 +6800,15 @@ remount (a project switch, a park re-adopt) each replay the four pulses. Still beye, and the idle gate covers the unfocused case. `styles.animation-gate.test.ts` pins the boundedshorthand, the resting opacity and the keyframe endpoints.-**A camera move freezes the viewport's raster scale, and only for the move.** `onCanvasMoveStart`-adds `canvas-camera-moving` to the flow wrapper in EVERY appearance (before the glass-only-early-return — it is not a glass feature), and `.canvas-camera-moving .react-flow__viewport` sets-`will-change: transform`, so the compositor scales the already-rastered layer instead of-re-rasterising every node's DOM at each intermediate zoom. MEASURED (12 WebGL terminals, 60 Hz-synthetic wheel zoom, M2, production build): **41–48% → 30–36%** total CPU, GPU process **22% →-15%**. It MUST stay transient: `onCanvasMoveEnd` removes the class 150 ms after the move settles so-text re-rasters sharp at the final scale — a permanent `will-change` on the viewport leaves every-terminal blurry after a zoom. `canvas/camera-moving.test.ts` pins both halves (the rule is scoped-to the class, and no bare `.react-flow__viewport` rule carries `will-change`).+**The viewport is never promoted — not even while the camera moves.** A `will-change: transform`+on `.react-flow__viewport` during pan/zoom was tried (00c9c5fc, measured 41–48% → 30–36% CPU on+12 WebGL terminals) and removed: the viewport layer spans the WHOLE canvas, and Chromium rasters it+at a scale it ratchets up during a zoom and never lowers. MEASURED on a 46-node SSH canvas (41+terminals, 1470×923 @2x, CDP-driven wheel zoom 0.8 ↔ 0.12 and pans, dev build): with it, 41–252+`tile memory limits exceeded, some content may not draw` warnings per gesture round — blank tiles,+which users saw as the canvas flickering on zoom — and no CPU gain (~170% total during the gesture+either way; the scripted gesture itself ran 36 s vs 28 s); without it, 0. The small-canvas gain+does not survive a real canvas. `canvas/camera-moving.test.ts` pins the absence.## Remote access (phone relay) — free, not Prodiff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 7006c1619..e47cd7263 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -1666,9 +1666,6 @@ export function Canvas() {const onCanvasMoveStart = useCallback(() => {if (movingClearRef.current) clearTimeout(movingClearRef.current)movingClearRef.current = null- // Every appearance: freeze the viewport's raster scale for the duration of the move (see the- // `.canvas-camera-moving` rule). Before the glass early-return — this is not a glass feature.- flowWrapRef.current?.classList.add('canvas-camera-moving')if (keepBlurWhileMovingRef.current) returnflowWrapRef.current?.classList.add('canvas-moving')}, [])@@ -1677,7 +1674,6 @@ export function Canvas() {movingClearRef.current = setTimeout(() => {movingClearRef.current = nullflowWrapRef.current?.classList.remove('canvas-moving')- flowWrapRef.current?.classList.remove('canvas-camera-moving')}, 150)}, [])useEffect(diff --git a/src/renderer/canvas/camera-moving.test.ts b/src/renderer/canvas/camera-moving.test.tsindex 3aef2332b..dbe1390d6 100644--- a/src/renderer/canvas/camera-moving.test.ts+++ b/src/renderer/canvas/camera-moving.test.ts@@ -4,22 +4,18 @@ import { join } from 'node:path'const read = (rel: string) => readFileSync(join(__dirname, '..', rel), 'utf8').replace(/\r\n/g, '\n')-describe('camera-moving raster freeze', () => {- it('styles.css promotes the viewport only while the camera moves', () => {- const css = read('styles.css')- expect(css).toMatch(/\.canvas-camera-moving \.react-flow__viewport\s*\{[^}]*will-change:\s*transform/)- // Never permanently: a permanent will-change freezes raster scale and blurs text after zoom.- expect(css).not.toMatch(/(^|\n)\.react-flow__viewport\s*\{[^}]*will-change/)+// The viewport must never be promoted with `will-change: transform` — not permanently and not+// during a camera move. MEASURED (see the comment in styles.css where the rule used to be): it+// overran Chromium's tile budget on a real canvas (blank tiles = flicker) with no CPU gain.+describe('viewport is never promoted', () => {+ it('styles.css has no will-change on .react-flow__viewport', () => {+ const css = read('styles.css').replace(/\/\*[\s\S]*?\*\//g, '')+ const rules = css.match(/[^{}]*\.react-flow__viewport[^{]*\{[^}]*\}/g) ?? []+ for (const r of rules) expect(r).not.toMatch(/will-change/)+ expect(css).not.toContain('.canvas-camera-moving')})- it('Canvas adds the class on move start BEFORE the glass early-return, and clears it on end', () => {- const src = read('canvas/Canvas.tsx')- const start = src.slice(src.indexOf('const onCanvasMoveStart'), src.indexOf('const onCanvasMoveEnd'))- const add = start.indexOf("classList.add('canvas-camera-moving')")- const glassReturn = start.indexOf('if (keepBlurWhileMovingRef.current) return')- expect(add).toBeGreaterThan(-1)- expect(add).toBeLessThan(glassReturn)- const end = src.slice(src.indexOf('const onCanvasMoveEnd'), src.indexOf('const onCanvasMoveEnd') + 600)- expect(end).toContain("classList.remove('canvas-camera-moving')")+ it('Canvas no longer toggles a camera-moving class', () => {+ expect(read('canvas/Canvas.tsx')).not.toContain('canvas-camera-moving')})})diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 876a207d6..1144f047a 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -1566,14 +1566,14 @@ body,.term-node--glass .term-node__body {background: transparent;}-/* Camera move (pan / zoom), every appearance: promote the viewport so the compositor scales the- already-rastered layer instead of re-rasterising every node's DOM at each intermediate zoom.- MEASURED (12 WebGL terminals, 60 Hz wheel zoom, M2): 41–48% → 30–36% total CPU, GPU process- 22% → 15%. Only WHILE moving: the class is removed 150 ms after the move settles so text- re-rasters sharp at the final scale — a permanent will-change would leave it blurry. */-.canvas-camera-moving .react-flow__viewport {- will-change: transform;-}+/* NO `will-change: transform` on `.react-flow__viewport`, not even while the camera moves. It was+ tried (00c9c5fc) to let the compositor scale an already-rastered layer through a pan/zoom, and+ on a real canvas it does the opposite of saving work: the viewport layer spans the WHOLE canvas,+ and Chromium rasters it at a scale it ratchets up during a zoom and never lowers. MEASURED on a+ 46-node SSH canvas (41 terminals, 1470x923 @2x, CDP-driven wheel zoom 0.8 <-> 0.12 and pans):+ with it, 41-252 "tile memory limits exceeded, some content may not draw" warnings per gesture+ round (blank tiles = the canvas flickering) and no CPU gain (~170% during the gesture either+ way, the scripted gesture 36 s vs 28 s); without it, 0. camera-moving.test.ts pins its absence. *//* The blur is re-rasterised for every glass node on every frame of a pan/zoom (their backdropmoves under them). With Keep blur while moving OFF (settings.glassBlurWhileMoving), Canvas marksthe flow wrapper while the camera moves; the tint stays, and the tint alone is what keeps text at