DynamoDS/DYN-10149: As a Dynamo user, I want the home and end keys to navigate to notes as well.#17136
Closed
eamiri wants to merge 3 commits into
Closed
DynamoDS/DYN-10149: As a Dynamo user, I want the home and end keys to navigate to notes as well.#17136eamiri wants to merge 3 commits into
eamiri wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-10149
…roups Refactors the Home/End candidate construction in DynamoViewModel so that orphaned NoteModels and notes-only AnnotationModels participate in the leftmost/rightmost ranking alongside nodes. Notes inside mixed (node+note) groups are intentionally excluded so they do not steer the camera away from the group bounding box that already covers them. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Comment on lines
+4558
to
+4564
| foreach (var avm in annotations) | ||
| { | ||
| if (avm.AnnotationModel.ContainsModel(node)) | ||
| { | ||
| models.Add(avm.AnnotationModel); | ||
| } | ||
| } |
| { | ||
| foreach (var candidate in candidates) | ||
| { | ||
| foreach (var model in candidate.Models) |
Add 12 NUnit tests in CoreUITests.cs covering the extended Home/End shortcut behavior: - Legacy node-only navigation (Home/End select leftmost/rightmost node and fit the view) - Orphaned notes participating in the leftmost/rightmost ranking - Notes-only groups participating in the ranking - Notes inside a node-containing group ride along with the group and do not contribute their own X to the ranking - Notes-only workspace still responds to Home/End - Empty workspace is a no-op - IsHomeAndEndKeyEnabled gate disables both shortcuts for any selectable type (NodeModel, NoteModel, AnnotationModel) Selection contents during the command are verified via a NotifyCollectionChanged hook on DynamoSelection, which is robust to the implementation clearing the selection at the end. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
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 Navigation to Notes — Implementation Plan
h2. Overview
Extend the existing {{Home}}/{{End}} keyboard shortcuts (DYN-9637) so that, in addition to leftmost/rightmost nodes, they also navigate to orphaned notes and to notes-only groups. The change is localized to the {{"Home And End key press events in Canvas"}} region in {{DynamoViewModel.cs}}, plus new tests in {{CoreUITests.cs}}. No public API, XAML, or resource changes are required.
h2. Current State Analysis
h3. Key Discoveries
h2. Desired End State
Verification: Run {{dotnet test test/DynamoCoreWpfTests/DynamoCoreWpfTests.csproj --filter "Name
GoToLeftMost|NameGoToRightMost"}} — all new tests pass; manual smoke test in Dynamo Sandbox with a graph that has nodes, orphaned notes, and notes-only groups confirms the camera centers on the expected element.h2. What We're NOT Doing
h2. Implementation Approach
Refactor {{FitCanvasToSelectedNodes}} into a shape that accepts a heterogeneous candidate list (each candidate knows its left edge, right edge, and which {{ISelectable}}s to add — possibly including a containing group). {{GoToLeftMostNode}} / {{GoToRightMostNode}} build that list from three sources (nodes, orphaned notes, notes-only groups), pick the winners by {{X}} or {{X + Width}} within {{tolerance}}, and delegate selection + {{FitView}} to the shared helper. Relax the guard from {{Nodes.Count > 0}} to "candidate list is non-empty".
The simplest concrete shape: introduce a private nested struct/record (e.g. {{HomeEndCandidate}}) capturing {{Left}}, {{Right}}, and an {{IEnumerable Selection}}. This stays internal, requires no allocations beyond the existing per-call ones, and keeps the diff readable.
h3. TASK 1: Extend Home/End logic in {{DynamoViewModel}} [HIGH PRIORITY]
Status: DONE
Milestone: {{Home}}/{{End}} shortcuts in a running sandbox correctly target orphaned notes and notes-only groups in addition to nodes; no regression in existing node-only behavior.
** One candidate per {{NodeViewModel}} in {{CurrentSpaceViewModel.Nodes}}: {{Left = nvm.X}}, {{Right = nvm.X + nvm.ActualWidth}}, {{Models = [nvm.NodeModel, ...any AnnotationModel that contains nvm.NodeModel]}}.
** One candidate per orphaned {{NoteViewModel}} (where no {{AnnotationModel}} in the workspace contains its {{Model}}): {{Left = noteVM.Model.X}}, {{Right = noteVM.Model.X + noteVM.Model.Width}}, {{Models = [noteVM.Model]}}.
** One candidate per notes-only {{AnnotationViewModel}} (where {{.Nodes.OfType().Any() == false}} AND {{.Nodes.OfType().Any()}}): {{Left = avm.Left}}, {{Right = avm.Left + avm.Width}}, {{Models = [avm.AnnotationModel]}}.
Validation:
Requirements from spec:
Files to Modify:
Implementation Details:
h3. TASK 2: Add NUnit coverage for legacy and new behavior [HIGH PRIORITY]
Status: DONE
Milestone: All Home/End behavior is exercised by automated tests; future regressions are caught locally and in CI.
Validation:
HomeAndEnd|NameGoToLeftMost|Name~GoToRightMost"}} — all new tests pass; no existing tests regress.Requirements from spec:
Files to Modify:
Implementation Details:
h2. Testing Strategy
h3. Unit Tests
h3. Integration Tests
h3. Manual Testing Steps
Launch {{DynamoSandbox}} ({{msbuild src/Dynamo.All.sln /p:Configuration=Release}} then run the sandbox exe).
Open an empty graph. Press {{Home}}, then {{End}} — view should not change, no exception.
Add one node, three orphaned notes (one to the far left, one to the far right, one centered). Press {{Home}} — view fits to the leftmost note. Press {{End}} — view fits to the rightmost note.
Add a group containing only two notes, place it to the left of all nodes. Press {{Home}} — view fits to that group.
Add a group containing one node and one note where the note's X < the node's X but the group's overall bounding box matches the node. Press {{Home}} — view fits to the group/node, not the note.
Select any item (node, note, or group) and press {{Home}}/{{End}} — the camera should not move (gate disables the shortcut).
Verify symmetry: repeat steps 3-6 with {{End}} in place of {{Home}}.
h2. Performance Considerations
h2. Migration Notes
None. The change is purely additive: existing behavior for nodes is preserved exactly, and no persisted state, file format, or public API surface is affected. No upgrade path needed for existing graphs.