DynamoDS/DYN-10149: As a Dynamo user, I want the home and end keys to navigate to notes as well.#17145
Closed
eamiri wants to merge 1 commit into
Closed
DynamoDS/DYN-10149: As a Dynamo user, I want the home and end keys to navigate to notes as well.#17145eamiri wants to merge 1 commit into
eamiri wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10149
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.
Closes https://autodesk.atlassian.net/browse/DYN-10149
h1. Extend Home/End to Notes — Implementation Plan
h2. Overview
Extend the Home and End keyboard shortcuts (introduced by DYN-9637) so that orphaned notes and notes-only groups participate in the leftmost/rightmost ranking alongside nodes. Notes that live inside a node-containing group continue to ride along with their parent group rather than influencing the ranking themselves. Add NUnit coverage for both the legacy node behavior (currently untested) and the new note behavior.
h2. Current State Analysis
h3. Key Discoveries:
h2. Desired End State
After this plan is complete:
Pressing {{Home}} on a workspace with notes outside groups, notes-only groups, and/or nodes selects the leftmost element(s) (any combination of node, orphaned-note, notes-only-group whose Left edge is within {{tolerance}} of the global min) and fits the canvas to that selection.
Pressing {{End}} does the symmetric thing for rightmost.
A note inside a node-containing group never directly influences the ranking — its parent group still wins via the node it contains.
A workspace with only notes (no nodes) still responds to Home/End.
The {{IsHomeAndEndKeyEnabled}} gate still disables both shortcuts when anything is selected (no behavior change there).
NUnit tests cover the legacy node-only path and all new note paths.
Verification: Build {{src/Dynamo.All.sln}} in Release; run the new {{Home/End}} NUnit suite in {{test/DynamoCoreWpfTests/CoreUITests.cs}}; manually open a graph with mixed nodes/notes/groups in DynamoSandbox and verify Home/End behavior matches the table in Task 1.
h2. What We're NOT Doing
h2. Implementation Approach
Introduce a private {{HomeEndCandidate}} shape (struct or local record) inside {{DynamoViewModel}} that captures {{(Left, Right, Models)}} — {{Models}} is the set of {{ISelectable}} items to add to the selection when that candidate wins. Build the candidate set once, find the min-Left (or max-Right) within {{tolerance}}, then select and {{FitViewCommand.Execute(true)}}. The shape lets the Home and End handlers share the candidate-builder and only differ in the ranking projection.
Keep the change footprint small: one file ({{DynamoViewModel.cs}}) + one test file ({{CoreUITests.cs}}). Do not refactor unrelated code.
h3. TASK 1: Replace the Home/End candidate-building logic in DynamoViewModel [HIGH PRIORITY]
Status: NOT STARTED
Milestone: {{Home}} and {{End}} keys navigate to orphaned notes and notes-only groups in addition to nodes; notes inside node-containing groups continue to ride along with the group; notes-only workspaces still respond.
Validation:
{code:bash}dotnet build src/DynamoCore.sln -c Release
msbuild src/Dynamo.All.sln /p:Configuration=Release # Windows{code}
Behavior table to verify manually in DynamoSandbox:
||Workspace contents||Home target||End target||
|Only nodes (legacy)|Leftmost node + its group(s)|Rightmost node + its group(s)|
|Nodes + orphaned note left of all nodes|The orphaned note|Rightmost node|
|Nodes + note inside node-containing group, note further left than any node|Leftmost node (note rides via parent group)|Rightmost node|
|Notes-only group left of all nodes|The notes-only group|Rightmost node|
|Only orphaned notes|Leftmost note|Rightmost note|
|Only notes-only groups|Leftmost group|Rightmost group|
|Empty workspace|No-op|No-op|
|Any selection already present|Disabled (no-op)|Disabled (no-op)|
Requirements from spec:
Files to Create: None.
Files to Modify:
Implementation Details:
h3. TASK 2: Add NUnit coverage for legacy and new Home/End behavior [HIGH PRIORITY]
Status: NOT STARTED
Milestone: Every behavior cell in the Task 1 table is exercised by an automated test; both the legacy DYN-9637 node behavior and the new note behavior are protected against regression.
*# {{WhenWorkspaceIsEmptyThenGoToLeftMostNodeIsNoOp}}
*# {{WhenWorkspaceIsEmptyThenGoToRightMostNodeIsNoOp}}
*# {{WhenOnlyNodesPresentThenGoToLeftMostNodeSelectsLeftmost}}
*# {{WhenOnlyNodesPresentThenGoToRightMostNodeSelectsRightmost}}
*# {{WhenOrphanedNoteIsLeftOfNodesThenGoToLeftMostNodeTargetsTheNote}}
*# {{WhenNoteIsInsideNodeGroupAndFurtherLeftThenGoToLeftMostNodeTargetsTheNode}}
*# {{WhenNotesOnlyGroupIsLeftmostThenGoToLeftMostNodeTargetsTheGroup}}
*# {{WhenWorkspaceHasOnlyOrphanedNotesThenGoToLeftMostNodeStillWorks}}
*# {{WhenSelectionExistsThenHomeAndEndAreDisabled}} (covers all three selectable types).
*# Symmetric End variants where they add coverage that the Home variant did not.
Validation:
{code:bash}dotnet test test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj --filter "Name
Home|NameEnd&Category=DynamoUI"{code}All new tests should pass; existing tests in {{CoreUITests.cs}} (Fit to View, Notes) should continue to pass.
Requirements from spec:
Files to Create: None.
Files to Modify:
Implementation Details:
h2. Testing Strategy
h3. Unit Tests:
** Multiple candidates tied within {{tolerance = 2}} pixels — all should be added to the selection.
** A workspace containing a notes-only group whose Left edge is exactly equal to a node's Left edge (tolerance behavior is preserved).
** A note pinned to a node (note position is computed from the node) — should be carried by the node's containing group via the existing path; not directly considered in the ranking.
h3. Integration Tests:
h3. Manual Testing Steps:
Build {{src/Dynamo.All.sln}} Release and launch DynamoSandbox.
Open a fresh workspace. Press {{Home}}/{{End}} — no-op (empty workspace).
Add three number nodes spread horizontally. Press {{Home}} — leftmost node selected + fit. Press {{End}} — rightmost node selected + fit.
Add an orphaned note far to the left of all nodes. Press {{Home}} — note selected + fit (camera should center on the note, not the leftmost node).
Group two nodes together and add a note inside that group, positioned further left than the leftmost ungrouped node. Press {{Home}} — the leftmost ungrouped node (or the group containing the node, if it tied) is targeted; the note inside the group does not drag the camera leftward beyond its parent group.
Create a notes-only group at the far left. Press {{Home}} — that group is selected + fit.
Select any node or note or group manually, then press {{Home}}/{{End}} — both are no-ops (disabled by the gate).
Repeat the symmetric scenarios for {{End}} (rightmost).
h2. Performance Considerations
h2. Migration Notes