From e2b20e4dcc8866d81baa880a3fb864e7bea1d240 Mon Sep 17 00:00:00 2001 From: Rishi Sharma Date: Tue, 17 Nov 2026 18:32:06 -0500 Subject: [PATCH] Make the canvas Focus button a toggle --- .../verify-screens/features/camera-focus.md | 10 ++++-- .../skills/verify-screens/features/layers.md | 4 +++ packages/canvas/src/shell/ScreenCanvas.tsx | 31 +++++++++++++------ packages/canvas/src/shell/app.css | 21 +++++++++---- plugins/screens/mcp.json | 2 +- plugins/screens/plugin.json | 2 +- release/package.json | 2 +- 7 files changed, 51 insertions(+), 21 deletions(-) diff --git a/.agents/skills/verify-screens/features/camera-focus.md b/.agents/skills/verify-screens/features/camera-focus.md index 441eeca..6ffe268 100644 --- a/.agents/skills/verify-screens/features/camera-focus.md +++ b/.agents/skills/verify-screens/features/camera-focus.md @@ -7,7 +7,7 @@ A person pans with Hand, Shift-drag, the middle button or the wheel. They zoom w - `cam-pan`: Hand, Shift-drag and the wheel pan by the screen delta, with no revision. - `minimap`: the map is off by default. Turn it on to see the canvas and navigate by click or drag. The choice survives a reload. - `cam-zoom`: zoom out and in around the centre; Cmd+0 goes to 100%; Fit all frames everything and turns auto-fit back on. -- `focus`: the Focus action, or the agent's `focus_item`, fits one frame and hides the others. Exit focus or Escape returns. +- `focus`: the Focus action, the toolbar toggle, or the agent's `focus_item` fits one frame and hides the others. The toggle, Exit focus, or Escape returns. - `focus-wheel`: in focus with Move, the wheel over the live page pans the camera, as Hand does. A scroll area inside the page keeps the wheel while it can still scroll. - `focus-large`: a 40-screen board opens at a readable zoom at the top, scrolls to both ends without leaving focus, hides other objects and restores the previous camera on exit. - `wheel-root-overflow`: overflowing body content under a hidden or clipped viewport never traps the wheel, in focus or with only selection. @@ -22,7 +22,7 @@ A person pans with Hand, Shift-drag, the middle button or the wheel. They zoom w ## How to get to it (user POV) -- Press H or hold Shift and drag. Use the zoom buttons, Cmd+wheel, the Focus action on a selected frame, and Escape. +- Press H or hold Shift and drag. Use the zoom buttons or Cmd+wheel. Select a frame and use Focus in the toolbar to enter or exit focus. The top-right Exit focus action and Escape also exit focus. - Click the map icon in the zoom controls. Click the overview to jump or drag the viewport outline to pan. - An agent calls `show_items`, `focus_item`, `get_view` and `open_screen`. @@ -88,6 +88,12 @@ expect dom.minimap=null ```screens id=focus add_object title=A files=fixture:plain x=0 y=0 height=300 as=@A add_object title=B files=fixture:plain x=500 y=0 height=300 as=@B +click @A.title +mark overview view +click ui:"Focus selection" +wait view.focus=focused:@A dom.@B.visible=false +click ui:"Focus selection" +wait view.focus=none dom.@B.visible=true view.camera=mark:overview storage.rev=doc.rev focus @A expect view.focus=focused:@A dom.@B.visible=false exit-focus diff --git a/.agents/skills/verify-screens/features/layers.md b/.agents/skills/verify-screens/features/layers.md index f6efa57..3d43bfe 100644 --- a/.agents/skills/verify-screens/features/layers.md +++ b/.agents/skills/verify-screens/features/layers.md @@ -97,6 +97,10 @@ focus @A expect dom.layers=null click ui:Layers wait dom.layers.rows.size=6 +click ui:Comments +expect view.comment.panelOpen=true dom.layers=null +click ui:Layers +wait view.comment.panelOpen=false dom.layers.rows.size=6 ``` ```screens id=layers-click diff --git a/packages/canvas/src/shell/ScreenCanvas.tsx b/packages/canvas/src/shell/ScreenCanvas.tsx index e8d13e7..393c35a 100644 --- a/packages/canvas/src/shell/ScreenCanvas.tsx +++ b/packages/canvas/src/shell/ScreenCanvas.tsx @@ -123,6 +123,7 @@ export function ScreenCanvas({ client, viewId, onRuntime, leading, trailing }: { useEffect(() => { setCompactLayersOpen(false); }, [focusId]); // The optional index is independent of comment placement and the active bubble. const commentsOpen = v.comment.panelOpen; + const toggleComments = () => rt.dispatch({ type: "command", command: { kind: "comments-panel", open: !commentsOpen } }); const layersOpen = compactCanvas ? compactLayersOpen : wideLayersOpen; const toggleLayers = () => { if (compactCanvas) { setCompactLayersOpen(!compactLayersOpen); return; } @@ -241,10 +242,12 @@ export function ScreenCanvas({ client, viewId, onRuntime, leading, trailing }: { ))} - {/* Always present, so selecting never moves the tools; disabled without a single selected object. */} - + +
+ {!presenting && focusId && <> +
+ {base.layout === "slides" && } + {editId && } + +
+ + } + +
{!presenting && st.roster.length > 0 &&