Conversation
erikdarlingdata
left a comment
There was a problem hiding this comment.
Nice work — clean separation with the DataGridBehaviors helper, and handling Avalonia's scrollbar quirks correctly. A few things I noticed:
1. Reflection on internal methods (fragile)
ProcessHorizontalScroll / ProcessVerticalScroll are private Avalonia internals accessed via reflection. If Avalonia renames or removes them in a future version, this breaks silently — the scrollbar Value would update but the grid content wouldn't visually scroll. The null checks degrade gracefully, but worth calling out as a maintenance risk.
2. Scroll direction may be inverted
The delta uses scrollStartH + delta.X, which moves the scrollbar in the same direction as the mouse. Typical pan behavior drags the content, not the scrollbar thumb — dragging right should reveal content to the left. You might want to negate the deltas:
hBar.Value = Math.Clamp(scrollStartH - delta.X, hBar.Minimum, hBar.Maximum);
// ...
vBar.Value = Math.Clamp(scrollStartV - delta.Y, vBar.Minimum, vBar.Maximum);Test both directions and see which feels more natural. Browser and PDF viewer pan behavior uses the negated version.
3. Opened change is unrelated
The MainWindow change deferring plan loading to the Opened event is a separate fix. Not a blocker, but ideally would be its own commit so bisecting is easier if something regresses.
|
@erikdarlingdata all (3) changes done. |
erikdarlingdata
left a comment
There was a problem hiding this comment.
All three items addressed cleanly — reflection replaced with public Thumb.DragDeltaEvent, scroll direction fixed, and the Opened change separated out. Thanks for the contribution and for the quick turnaround on the feedback, @ClaudioESSilva!
What does this PR do?
Implements #225
Which component(s) does this affect?
How was this tested?
Check the video on #225
Checklist
dotnet build -c Debug)dotnet test)