Skip to content

Commit 4ef1f7c

Browse files
committed
Enable target graph horizontal scroll with mouse wheel
Like other panels in this app, holding shift and scrolling the mouse wheel should scroll horizontally rather than vertically.
1 parent c2338c8 commit 4ef1f7c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/StructuredLogViewer/Controls/GraphControl.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ public GraphControl()
4747
grid.Children.Add(canvas);
4848
grid.Children.Add(layersControl);
4949

50-
scrollViewer = new ScrollViewer()
50+
scrollViewer = new ScrollViewer
5151
{
5252
HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
53-
VerticalScrollBarVisibility = ScrollBarVisibility.Auto
53+
VerticalScrollBarVisibility = ScrollBarVisibility.Auto,
54+
Content = grid
5455
};
55-
scrollViewer.Content = grid;
56+
scrollViewer.SetValue(ScrollViewerHelper.ShiftWheelScrollsHorizontallyProperty, true);
5657
}
5758

5859
private bool darkTheme;

src/StructuredLogViewer/ScrollViewerHelper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ private static T FindDescendant<T>(this DependencyObject d) where T : Dependency
5353
if (d == null)
5454
return null;
5555

56+
if (d is T t)
57+
return t;
58+
5659
var childCount = VisualTreeHelper.GetChildrenCount(d);
5760

5861
for (var i = 0; i < childCount; i++)

0 commit comments

Comments
 (0)