Skip to content

feat(renderer): a right-click or Control-click on a node tells the host, for its menu (macOS) - #104

Merged
LeslieOA merged 1 commit into
developfrom
feat/node-context-menu
Nov 1, 2026
Merged

LeslieOA merged 1 commit into
developfrom
feat/node-context-menu

Conversation

@LeslieOA

@LeslieOA LeslieOA commented Nov 1, 2026

Copy link
Copy Markdown
Member

The macOS half of #74. iOS has onNodeLongPress (#103); this adds its Mac twin.

  • onNodeContextMenu(node, press): a right-click or Control-click on a node reports the node and a NodeLongPress (where the click was, the card's frame on screen, and what a preview of it draws). A click on empty canvas reports nothing. The library only reports; the host draws its own menu.
  • The click comes from the same source as the trackpad double-tap:
    • a host's ScrollWheelBridge, sending onContextClick in the canvas's own coordinates, when the host has one;
    • otherwise the library's WorkspaceJsonCanvasGesture, which watches context clicks window-wide only while a canvas has a host listening (setContextClickTracking, counted per canvas). It never consumes them, so the rest of the window keeps its own menus.
  • The long-press and the context click share one hit test (nodeAt, smallest area wins) and one way of describing the press (pressOn).

Checked in Workspace's macOS app with all-node-types.canvas: a right-click on the text, link and image cards reports each card; the group and empty canvas report nothing. Typecheck unchanged; 208 tests pass.

🤖 Generated with Claude Code

…st, for its menu (macOS)

onNodeContextMenu is the Mac's twin of onNodeLongPress: a right-click or
Control-click on a node reports the node, where the click was, the card's
frame on screen and what a preview of it draws. A click on empty canvas
reports nothing.

The click comes from the same source as the trackpad double-tap: a host's
ScrollWheelBridge, as onContextClick in the canvas's own coordinates, when
it has one; otherwise the library's bridge, which watches context clicks
window-wide only while a canvas has a host listening, and never consumes
them, so anything else in the window keeps its own menu.

Refs: #74

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LeslieOA
LeslieOA merged commit e1885e1 into develop Nov 1, 2026
1 check passed
@LeslieOA
LeslieOA deleted the feat/node-context-menu branch November 1, 2026 18:21
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