Offer a node's own menu on right-click, to add a pin - #76
Merged
Merged
Conversation
…nor] Right-clicking a node opened the create-node palette, the same menu empty canvas offers, so the only way to grow a variadic slot was to select the node and press the inspector's +. The gesture now decides which menu it means: over a node it opens that node's own menu, over empty canvas the palette as before. The menu offers one entry per slot that can hold another child, which is the same undoable edit the inspector's + makes, and says so rather than opening empty when the node has no such slot. Which slots those are is a fact about the node's shape, so AstSchema.GrowableSlotsOf answers it and the draw call holds no rule of its own. Removing a pin is deliberately left out: the slot is an ordered sequence, so which child the user means is a question a node-level menu cannot ask. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011gZgXrkFA4Fy13yuxgmqKz
MSTEST0068 on the test this PR adds: Assert.AreSequenceEqual rather than CollectionAssert.AreEqual. The rest of the file keeps CollectionAssert, since Sonar reads only new code and rewriting the file is not this PR's business. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011gZgXrkFA4Fy13yuxgmqKz
matt-edmondson
pushed a commit
that referenced
this pull request
Sep 22, 2026
The same MSTEST0068 family Sonar raised on #76: Assert.Contains rather than CollectionAssert.Contains, on the line this PR adds. The two pre-existing uses in AstGraphTests keep theirs, since Sonar reads only new code and rewriting them is not this PR's business. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011gZgXrkFA4Fy13yuxgmqKz
|
matt-edmondson
pushed a commit
that referenced
this pull request
Sep 22, 2026
#76 landed the node's own menu on the same gesture this branch gives the pin, so both rewrote the one right-click handler. Settled as the PR said it would be: pin first, then node, then the palette — a pin sits inside a node, so a click over both is about the pin, the narrower target being the one it took aim to hit. The three-way choice is now OfferOwnMenu, so DrawPalette still reads as one decision rather than a chain. One behaviour follows from the order rather than from either side: a node's output pin has no menu of its own, so a right-click on one now falls through to the node's menu where before it opened the palette. That is whose actions they are. The remark on RequestPinMenu and the gesture test both say so now — the test asserting the node's menu answers a click on the title bar is what tells the two menus apart rather than one shadowing the other. 905 tests pass on the merge. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011gZgXrkFA4Fy13yuxgmqKz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #36
What changed
Right-clicking a node opened the create-node palette — the same menu empty canvas offers — so the only way to grow a variadic slot was to select the node and press the inspector's
+. The gesture now decides which menu it means: over a node it opens that node's own menu, over empty canvas it opens the palette exactly as before.The node menu offers one entry per slot that can hold another child (
Add Parameters,Add Body, …), and picking one makes the same undoable editAddChildalready makes for the inspector. A node whose every slot holds one child says so rather than opening empty, the way the dropped-link menu does.AstSchema.GrowableSlotsOf— which slots a child can be added to, answered where the rest of the node's shape is, so the draw call holds no rule of its ownAstGraphEditor.RequestNodeMenu(nodeId)— offers the menu without the gesture, mirroringRequestCreateFrom, so a host can bind it to a key and a test can drive itAstGraphEditor.DrawNodeMenu— the popup itself, following the dropped-link menu's shapeRemoving a pin is deliberately not here: the slot is an ordered sequence, so which child the user means is a question a node-level menu cannot ask, and disconnecting the child already says it. That is #35's half.
Tests
AstSchemaTests— three headless tests overGrowableSlotsOf: the variadic slots kept in pin order, a node whose slots all hold one child, and a leafAstGraphEditorNodeMenuTests— six rendered-frame tests throughImGuiAppHarness: the entry per growable slot, picking one adding and undoing, the "nothing to add" case, dismissal changing nothing, the refusal for a node outside the graph, and a real right-click on the node opening its menu rather than the paletteEach was proved to fail without the change, by three mutations run separately: reverting the right-click routing fails the gesture test alone (1 of 9), drawing no menu entries fails 4 of 6 menu tests, and dropping the cardinality filter fails the schema test and the "nothing to add" case.
Full suite on the branch: 894 passed, 0 failed. Release build clean, 0 warnings.
🤖 Generated with Claude Code
https://claude.ai/code/session_011gZgXrkFA4Fy13yuxgmqKz
Generated by Claude Code