Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ide): zoom pane maximize and restore with a compositor transform

rubenluetke10-beepc0e32eb3edc1
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index 0f0839f4ea..67b95dfa5b 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -782,6 +782,39 @@ describe("maximize", () => {
expect(screen.getByTestId("pane-Nova")).toBeTruthy();
expect(screen.getByTestId("pane-cell-Nova").className).toContain("hidden");
});
+
+ it("zooms with a compositor transform, never the layout glide", () => {
+ // Every element measures as the whole 1000x600 workspace, so the maximized
+ // pane ends at the full surface and starts at its (smaller) tile.
+ const rect = vi
+ .spyOn(HTMLElement.prototype, "getBoundingClientRect")
+ .mockReturnValue(DOMRect.fromRect({ x: 0, y: 0, width: 1000, height: 600 }));
+ const calls: { element: Element; keyframes: Keyframe[] }[] = [];
+ const original = HTMLElement.prototype.animate;
+ HTMLElement.prototype.animate = function (this: HTMLElement, keyframes) {
+ calls.push({ element: this, keyframes: keyframes as Keyframe[] });
+ return { cancel() {}, onfinish: null, oncancel: null } as unknown as Animation;
+ };
+ try {
+ renderGrid();
+ fireEvent.click(screen.getByTestId("pane-maximize-Mika"));
+ const cell = screen.getByTestId("pane-cell-Mika");
+ const zoom = calls.find((call) => call.element === cell);
+ expect(String(zoom?.keyframes[0].transform)).toMatch(/scale\(/);
+ calls.length = 0;
+ fireEvent.click(screen.getByTestId("pane-maximize-Mika"));
+ // The commit that swaps the box back must not also start the
+ // left/top/width/height transition.
+ expect(cell.className).not.toContain("transition-[left,top,width,height]");
+ // The neighbours fade back in on opacity alone.
+ const nova = screen.getByTestId("pane-cell-Nova");
+ const fade = calls.find((call) => call.element === nova);
+ expect(fade?.keyframes[0].opacity).toBe(0);
+ } finally {
+ HTMLElement.prototype.animate = original;
+ rect.mockRestore();
+ }
+ });
});
describe("closing a pane", () => {
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 83b6e0c39e..9eb2780115 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -379,6 +379,9 @@ const GRID_GAP_PX = 4;
/** Half of it — what each pane gives up on the sides it shares with a neighbour. */
const HALF_GAP_PX = GRID_GAP_PX / 2;
+/** How long a pane takes to zoom to the whole workspace and back. */
+const ZOOM_MS = 220;
+
/** A maximized pane simply fills the workspace. */
const MAXIMIZED_BOX: React.CSSProperties = {
position: "absolute",
@@ -1712,6 +1715,112 @@ export function AgenticGrid({
[registerCell],
);
+ /*
+ * Maximize and restore ZOOM instead of jumping.
+ *
+ * The pane's box used to swap between its tile and `inset: 0` in one repaint,
+ * and on the way back the move glide (a `left/top/width/height` transition)
+ * caught half of it: `width: auto` cannot be tweened, so the pane snapped to
+ * its small size and then slid across the workspace — while every hidden
+ * sibling woke up and the terminal refitted, all on the main thread. Every
+ * one of those frames was a layout pass, and the animation ran at a handful
+ * of frames per second (maintainer report 2026-09-29).
+ *
+ * Now the box takes its final place at once and the MOTION is a transform —
+ * the classic FLIP: measure where it was, where it is, and play the
+ * difference back as a translate + scale. A transform never lays anything
+ * out and runs on the compositor, so the zoom stays smooth even while the
+ * terminal reflows and the neighbours catch up underneath it. The move glide
+ * is switched off for the commit that swaps the box (`zoomCommit`), or it
+ * would start a second, layout-bound animation of the same change.
+ *
+ * The "before" rectangle is computed from the layout rather than measured,
+ * so every caller of `setMaximized` — the button, a jump, a request from
+ * another pane — gets the same zoom without having to measure first.
+ */
+ const lastMaximized = useRef<string | null>(maximized);
+ // Read during render on purpose: the commit that changes `maximized` is the
+ // one whose box swap must not also start the move glide.
+ const zoomCommit = lastMaximized.current !== maximized;
+ useLayoutEffect(() => {
+ const from = lastMaximized.current;
+ lastMaximized.current = maximized;
+ if (from === maximized || chatView) return;
+ if (
+ typeof window !== "undefined" &&
+ typeof window.matchMedia === "function" &&
+ window.matchMedia("(prefers-reduced-motion: reduce)").matches
+ ) {
+ return;
+ }
+ const surface = canvasRef.current?.getBoundingClientRect();
+ if (!surface || surface.width <= 0 || surface.height <= 0) return;
+ // The on-screen rectangle `paneBoxStyle` gives a tile, in viewport pixels.
+ const tileRect = (name: string) => {
+ const box = layout.boxes[session.terminals.findIndex((t) => t.name === name)];
+ if (!box) return surface;
+ const left = atEdge(box.x) ? 0 : HALF_GAP_PX;
+ const right = atEdge(box.x + box.w) ? 0 : HALF_GAP_PX;
+ const top = atEdge(box.y) ? 0 : HALF_GAP_PX;
+ const bottom = atEdge(box.y + box.h) ? 0 : HALF_GAP_PX;
+ return {
+ left: surface.left + box.x * surface.width + left,
+ top: surface.top + box.y * surface.height + top,
+ width: box.w * surface.width - left - right,
+ height: box.h * surface.height - top - bottom,
+ };
+ };
+ const zoom = (
+ name: string,
+ start: { left: number; top: number; width: number; height: number },
+ ) => {
+ const node = paneNodes.current.get(name);
+ if (!node || typeof node.animate !== "function") return;
+ for (const running of node.getAnimations?.() ?? []) running.cancel();
+ const end = node.getBoundingClientRect();
+ if (end.width <= 0 || end.height <= 0 || start.width <= 0 || start.height <= 0) return;
+ const dx = start.left - end.left;
+ const dy = start.top - end.top;
+ const sx = start.width / end.width;
+ const sy = start.height / end.height;
+ if (Math.abs(dx) < 1 && Math.abs(dy) < 1 && Math.abs(sx - 1) < 0.01 && Math.abs(sy - 1) < 0.01) {
+ return;
+ }
+ // Above its neighbours while it shrinks back over them.
+ node.style.zIndex = "10";
+ const animation = node.animate(
+ [
+ { transformOrigin: "0 0", transform: `translate(${dx}px, ${dy}px) scale(${sx}, ${sy})` },
+ { transformOrigin: "0 0", transform: "none" },
+ ],
+ { duration: ZOOM_MS, easing: "cubic-bezier(0.2, 0, 0, 1)" },
+ );
+ const done = () => node.style.removeProperty("z-index");
+ animation.onfinish = done;
+ animation.oncancel = done;
+ };
+ if (maximized !== null) {
+ zoom(maximized, tileRect(maximized));
+ return;
+ }
+ if (from === null) return;
+ zoom(from, surface);
+ // The neighbours come back with a fade rather than a pop — opacity is as
+ // compositor-only as the transform.
+ for (const term of session.terminals) {
+ if (term.name === from) continue;
+ const node = paneNodes.current.get(term.name);
+ if (!node || typeof node.animate !== "function") continue;
+ node.animate([{ opacity: 0 }, { opacity: 1 }], {
+ duration: ZOOM_MS,
+ easing: "ease-out",
+ });
+ }
+ // `layout` and the pane list are read, not reacted to: only a change of
+ // the maximized pane zooms.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [maximized]);
+
/*
* The layout watchdog: the screen has to MATCH the layout, and when it does
* not, the grid repairs itself instead of standing there looking broken.
@@ -2478,6 +2587,7 @@ export function AgenticGrid({
!chatView &&
!isMaximized &&
!layoutBusy &&
+ !zoomCommit &&
"transition-[left,top,width,height] duration-300 ease-out motion-reduce:transition-none",
/*
* The three rings below are drawn WITHOUT an offset, and that