Skip to content

Commit 7d8495d

Browse files
committed
Allow scrolling over obj cmds text
1 parent f807975 commit 7d8495d

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/Ray1Editor/UI/Views/Editor/Components/EditorTab_Properties.xaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
d:DataContext="{x:Static local:DesignDataContexts.EditorViewModel}"
1212
Foreground="{DynamicResource MahApps.Brushes.ThemeForeground}">
1313

14-
<ScrollViewer Padding="5 10 5 5"
14+
<ScrollViewer x:Name="PropertiesScrollViewer"
15+
Padding="5 10 5 5"
1516
VerticalScrollBarVisibility="Auto">
1617

1718
<Grid>
@@ -109,8 +110,10 @@
109110
SyntaxHighlighting="C++"
110111
HorizontalScrollBarVisibility="Disabled"
111112
VerticalScrollBarVisibility="Disabled"
113+
ScrollViewer.CanContentScroll="False"
112114
IsReadOnly="True"
113-
Margin="0 0 0 7" />
115+
Margin="0 0 0 7"
116+
PreviewMouseWheel="TextEditor_OnPreviewMouseWheel" />
114117

115118
</StackPanel>
116119

src/Ray1Editor/UI/Views/Editor/Components/EditorTab_Properties.xaml.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using ICSharpCode.AvalonEdit.Highlighting;
22
using System.ComponentModel;
33
using System.Windows.Controls;
4+
using System.Windows.Input;
45
using System.Windows.Media;
56

67
namespace Ray1Editor;
@@ -83,4 +84,18 @@ public EditorViewModel ViewModel
8384
get => DataContext as EditorViewModel;
8485
set => DataContext = value;
8586
}
87+
88+
private void TextEditor_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
89+
{
90+
// Redirect the mouse wheel movement to allow scrolling
91+
92+
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
93+
{
94+
RoutedEvent = MouseWheelEvent,
95+
Source = e.Source
96+
};
97+
98+
PropertiesScrollViewer?.RaiseEvent(eventArg);
99+
e.Handled = true;
100+
}
86101
}

0 commit comments

Comments
 (0)