added config to disable 'FixNestedScrolling' behavior (in case there is some unforseen problem, as this affects every ScrollViewer in our App)
This commit is contained in:
1 parent
31d2adade7
commit
5eb890844d
2 files changed
+10
No files matched your search
@@ -7,11 +7,17 @@ using System.Windows.Input;
|
||||
|
||||
namespace mbts.ui {
|
||||
class ScrollViewerCorrector {
|
||||
static readonly bool _fix_nested_scrolling_enabled = mbts.config.Configuration.get<bts.config.toggles.FixNestedScrolling>().enabled;
|
||||
static List<MouseWheelEventArgs> _reentrancy_list => ThreadStaticActivator<ReentrancyList>.instance;
|
||||
|
||||
public static readonly DependencyProperty FixNestedScrollingProperty =
|
||||
DependencyProperty.RegisterAttached("FixNestedScrolling", typeof(bool), typeof(ScrollViewerCorrector),
|
||||
new PropertyMetadata(false, (d, e) => {
|
||||
if (!_fix_nested_scrolling_enabled) {
|
||||
// this fix is applied to every ScrollViewer in the Application, which makes it inherently risky.
|
||||
// If an unforseen problem with this fix arises, it can be disabled in config (see 'FixNestedScrolling' in toggles.proto).
|
||||
return;
|
||||
}
|
||||
var target = WPFExceptionHelper.assert_dp_target_type<ScrollViewer>(d);
|
||||
if ((bool)e.NewValue == true)
|
||||
target.PreviewMouseWheel += _on_preview_mouse_wheel;
|
||||
|
||||
@@ -30,4 +30,8 @@ message SoundNotifications {
|
||||
|
||||
message VolumeAtPrice{
|
||||
optional bool enabled = 1 [default = true];
|
||||
}
|
||||
|
||||
message FixNestedScrolling {
|
||||
optional bool enabled = 1 [default = true];
|
||||
}
|
||||
Reference in new issue
Block a user