Skip to content

feat(web): zoom controls for workflow diagram - #249

Open
ikarys wants to merge 2 commits into
co-l:developfrom
ikarys:feat/workflow-diagram-zoom-clean
Open

feat(web): zoom controls for workflow diagram#249
ikarys wants to merge 2 commits into
co-l:developfrom
ikarys:feat/workflow-diagram-zoom-clean

Conversation

@ikarys

@ikarys ikarys commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

The workflow diagram in the editor scaled to container width and grew unboundedly with step count, making large workflows impossible to view whole. This adds zoom controls and fit-to-screen so the entire diagram is always navigable.

Changes

  • Fit-to-screen on open and workflow switch — entire diagram visible inside the panel without scrollbars, regardless of step count.
  • Zoom controls overlay (zoom in, zoom out, fit-to-screen) with bounded zoom (0.1×–4×). Hidden when there are no steps.
  • Ctrl/Cmd + wheel zoom toward the cursor (point under cursor stays fixed); page/modal does not scroll while zooming.
  • Scroll as pan — existing vertical scroll preserved; horizontal scroll enabled when zoomed in (ScrollArea `both`).
  • Zoom works in both read-only and edit modes; transition create/reconnect/delete remain disabled in read-only.
  • Existing interactions stay pixel-accurate at any zoom level: node/edge selection, drag-from-port, reconnect handles, delete-on-edge-key. Achieved by keeping the SVG `viewBox` fixed to logical coords and setting the rendered size via CSS (`width × zoom`), so `getSVGPoint` (which uses `getScreenCTM().inverse()`) stays correct.

Implementation

  • New `useWorkflowZoom` hook reads the SVG viewBox via ref (no duplicate `computeLayout` call). Exposes `zoomIn`/`zoomOut`/`fitToScreen` and derived `canZoomIn`/`canZoomOut`/`isFitted` flags (dumb client).
  • `FlowDiagram` uses `forwardRef` to expose the SVG element; fixed `viewBox` + explicit CSS size.
  • New `MinusIcon` and `ZoomFitIcon` components.

AI-Enhanced Development

  • AI Models: GLM 5.2 via OpenFox agent

Cache Impact

  • No — no changes to system prompts, tool definitions, skills, or cached context.

co-l and others added 2 commits August 14, 2026 16:32
The workflow diagram scaled to container width and grew unboundedly
with step count, making large workflows impossible to view whole.

- Fit-to-screen on open and workflow switch (entire diagram visible)
- Zoom in/out buttons + ctrl/cmd+wheel zoom toward cursor
- Bounded zoom (0.1x-4x), scroll as pan (horizontal enabled when zoomed)
- Zoom works in both read-only and edit modes
- Existing drag/reconnect/delete interactions stay pixel-accurate at any zoom

New useWorkflowZoom hook reads the SVG viewBox via ref (no duplicate
layout computation). FlowDiagram uses forwardRef + fixed viewBox with
explicit CSS size (width x zoom), keeping getSVGPoint correct at any zoom.
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