Skip to content

feat(flow): make designer cards resizable with a detail view - #1099

Open
zheng1114567 wants to merge 1 commit into
Tencent:mainfrom
zheng1114567:feat/flow-node-resize
Open

zheng1114567 wants to merge 1 commit into
Tencent:mainfrom
zheng1114567:feat/flow-node-resize

Conversation

@zheng1114567

Copy link
Copy Markdown

Problem

Cards were fixed at 244px wide with no way to resize them. At 100% zoom about five cards fit on screen, and the only way to see more was to zoom the whole canvas out.

Changes

  • Cards now default to 200px. The constants that assumed card width (viewport fallbacks, palette drops, AI camera centering, overlap spreading) follow.
  • A selected card shows a resize frame like the one in MiniMax Design's canvas (React Flow's NodeResizer): four round corner handles and four edge strips. Corners resize both axes, edges one axis, and when a size hits its limit the opposite edge stays put. Handle size is divided by the canvas zoom, so it keeps the same on-screen size when you zoom in.
  • Range is 180–480 wide and 96–640 tall. A card without an explicit height still sizes itself to its content; once a height is set, the tag area scrolls inside the card.
  • Tall cards (200px and up) use the extra room for the node's own detail instead of whitespace: role brief, artifacts and loop count for agent nodes; the script body for script nodes; the nested step list for SOP nodes; the confirmation ask for approval nodes. The detail goes away when the card gets shorter.
  • The size is saved as node.size {w,h}. domain.WorkflowNode gets an optional size field so it survives a round trip through the API.

How I checked

  • In Chromium with real mouse input: dragging the top-left corner kept the bottom-right corner fixed (200×156 clamped to 180×96, position adjusted); dragging the right edge changed only the width (180 → 323).
  • New tests cover the default size, clamping on both axes, persistence across re-renders, the eight handles appearing only on selection, and detail expansion at height 200 and above.
  • node --test tests/*.test.mjs in webtest: 217 passed.
  • I couldn't run the Go build here (no Go toolchain on the dev box). The Go change is only the optional struct field, so compile and Go tests are left to CI.

Screenshots of the frame and the expanded detail view are available if useful.

…rame

Cards were fixed at 244px wide, so a 100% canvas only fit a handful of
steps. Cards now default to 200px and a selected card shows the same
resize frame MiniMax Design uses (React Flow's NodeResizer): four round
corner handles plus four edge strips, sized in screen pixels so they stay
constant while the canvas zooms. Corners move both edges, sides move one,
clamping to 180-480px wide and 96-640px tall while pinning the opposite
edge. Tall cards spend the extra room on the node's own detail (role
brief, script body, nested steps, approval ask) instead of whitespace;
untouched cards keep their content-driven height and the footprint
persists with the workflow. Layout heuristics and drop/AI camera centering
use the new default width.
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.

1 participant