From 5eb890844d3c25cab047ca113c16054e9761719f Mon Sep 17 00:00:00 2001 From: John Colvin Date: Thu, 28 Mar 2019 13:54:56 -0500 Subject: [PATCH] added config to disable 'FixNestedScrolling' behavior (in case there is some unforseen problem, as this affects every ScrollViewer in our App) --- src/client/spark/view/Extensions/ScrollViewerCorrector.cs | 6 ++++++ src/lib/config/protos/toggles.proto | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/client/spark/view/Extensions/ScrollViewerCorrector.cs b/src/client/spark/view/Extensions/ScrollViewerCorrector.cs index bc88b4073..257a59c7c 100644 --- a/src/client/spark/view/Extensions/ScrollViewerCorrector.cs +++ b/src/client/spark/view/Extensions/ScrollViewerCorrector.cs @@ -7,11 +7,17 @@ using System.Windows.Input; namespace mbts.ui { class ScrollViewerCorrector { + static readonly bool _fix_nested_scrolling_enabled = mbts.config.Configuration.get().enabled; static List _reentrancy_list => ThreadStaticActivator.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(d); if ((bool)e.NewValue == true) target.PreviewMouseWheel += _on_preview_mouse_wheel; diff --git a/src/lib/config/protos/toggles.proto b/src/lib/config/protos/toggles.proto index db6a9eecf..85063637b 100644 --- a/src/lib/config/protos/toggles.proto +++ b/src/lib/config/protos/toggles.proto @@ -30,4 +30,8 @@ message SoundNotifications { message VolumeAtPrice{ optional bool enabled = 1 [default = true]; +} + +message FixNestedScrolling { + optional bool enabled = 1 [default = true]; } \ No newline at end of file