Skip to content

feat(studio): pick several cards with a box and find your way with a minimap - #103

Merged
xycld merged 1 commit into
mainfrom
feat/board-select-minimap
Nov 18, 2026
Merged

xycld merged 1 commit into
mainfrom
feat/board-select-minimap

Conversation

@xycld

@xycld xycld commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

What and why

A user who works with big projects reported two problems: they could only move cards one at a time, and they kept losing pictures on the board. They asked for box selection and a minimap like the canvas tools they also use. This PR builds the reviewed design from the follow-up to #100.

  • Picking cards. A left drag on the empty board draws a box (a tint, no outline) that picks every card it touches.
    • Shift, Ctrl or ⌘ clicks add a card or take it out. Ctrl+A picks every card. Esc keeps only the selected card.
    • Picked cards move together, and the move is written once, on release.
    • A bar above the group shows 已选 N 张, 排整齐 (rows of about √n from the group's corner) and 删除. 删除 asks once, and Delete does the same.
    • The left panel keeps showing the selected card. Picking itself is not saved: Board state that counts only while it includes selectedCanvasId.
  • Panning. Panning now uses the right button, the middle button, Space held over the board, or the 平移 tool. A right-click that does not move still opens the menu.
    • On Linux the context-menu event arrives while the button is down, so it waits for the release.
    • On Windows it arrives after the release and is ignored for 400 ms after a right-drag.
    • The wheel still zooms. F fits every card.
  • Minimap (studio/Minimap.tsx), in the bottom-right corner:
    • Every card is a small picture. Picked cards are in the accent colour, and running ones have a dot. The part of the board on screen is a tint.
    • A press or drag on it centres the view there.
    • The tint follows pans through view listeners, so it does not re-render the board, and it follows board resizes through a ResizeObserver.
    • A 小地图 button in the toolbar shows or hides it.
    • Cards placed near that corner keep clear of it (keepInView).
  • Departures from the design:
    • The minimap has no M shortcut, because M already toggles 遮罩.
    • Cards the box touches get the normal ring rather than a lighter preview ring.

docs/reference/studio-node-board.md describes the gestures, keys, picking and the minimap.

How it was verified

  • pnpm lint (0 errors; the warnings were already there), pnpm format:check, pnpm typecheck, pnpm test:unit: 3823 passed, 6 of them new in test/renderer/studio/selection.test.ts (box hit test, toggling, reading order, 排整齐 layout, minimap fit).
  • pnpm build && pnpm test:e2e: 446 passed. New or changed in board.e2e.ts:
    • Pan: with the right and middle buttons and with Space (even starting on a card). A right-drag leaves no menu behind. Wheel zoom and placing a new card still work, and F shows every card.
    • Box: picks the two pictures but not the 画面, shows a ring and the bar, makes the first picked card the selected one, moves both by the same amount, lines them up with 排整齐, and deletes them after one confirmation.
    • Keys and clicks: Shift-click adds and removes, Esc, Ctrl+A, Delete asks once. A plain click picks one card. Selecting another card ends the group, so an old member selected again comes alone. This check fails without the fix.
    • Minimap, light and dark: three cards, picked ones in the accent colour, expectVisualRules clean, a press centres the view on that card, the toggle hides it, and no + shows on a picked group.
    • Placing cards: a card placed near the corner keeps clear of the minimap. This check fails without the fix.
    • The default spot for the blank-menu helper moved left of the minimap, which now covers the old one.
  • Light and dark checked from the E2E screenshots board-minimap-light, board-minimap-dark and board-picked-light.
  • Smoothness unchanged: on a 60-card board (each card with 3 runs), measured the same way as in fix(studio): keep the board smooth with many cards #100, pan, drag and zoom time the same as main.
  • pnpm test:install: not applicable.
  • Docs updated: docs/reference/studio-node-board.md (board row, keys, picking, minimap).

Platforms affected

  • Windows
  • Linux
  • macOS
  • Platform-independent. The right-click timing differs between Linux and Windows, and both are handled (see above). Only Linux ran in E2E.

Notes for the reviewer

  • Behaviour change: a left drag on the empty board no longer pans. Users and the tutorial-free UI rely on the other ways to pan: right or middle drag, Space, the 平移 tool, and now the minimap.
  • Delete on a single selected card now asks to delete it. Before, Delete did nothing unless a region or wire was selected. A selected region or wire still takes Delete first. Selecting several cards clears the selected region, so Delete after Ctrl+A cannot remove a region by surprise.
  • Picked cards reuse the memoized CanvasCard. The only new prop is a boolean marked; callbacks still go through bind.

…minimap

A left drag on the empty board now draws a box that picks every card it
touches; Shift, Ctrl or Cmd clicks add or remove one, Ctrl+A picks all,
Esc keeps only the selected card. Picked cards move together, and a bar
over them offers 排整齐 and 删除 (asked once; Delete does the same).
Panning moves to the right or middle button, Space held, or the 平移 tool;
a right-click that does not move still opens the menu. A minimap in the
board's corner shows every card and the part on screen; a press there
moves the view, and new cards placed near it keep clear of it. F fits.
@xycld
xycld added this pull request to the merge queue Nov 18, 2026
Merged via the queue into main with commit 46ba920 Nov 18, 2026
5 checks passed
@xycld
xycld deleted the feat/board-select-minimap branch November 18, 2026 16:29
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