From fabead4e65190cc74602f99418e76783522de67c Mon Sep 17 00:00:00 2001 From: LeapwardKoex Date: Tue, 16 Apr 2024 21:19:50 +1200 Subject: [PATCH] MInor performance increase --- TouchPanel.xaml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/TouchPanel.xaml.cs b/TouchPanel.xaml.cs index 682da5b..6bf10fc 100644 --- a/TouchPanel.xaml.cs +++ b/TouchPanel.xaml.cs @@ -16,6 +16,7 @@ public partial class TouchPanel : Window private readonly Dictionary activeTouches = []; private readonly TouchPanelPositionManager _positionManager; private List buttons = []; + private bool isDebugEnabled = Properties.Settings.Default.IsDebugEnabled; private enum ResizeDirection { @@ -168,6 +169,7 @@ private void DeselectAllItems() public void SetDebugMode(bool enabled) { + isDebugEnabled = enabled; buttons.ForEach(button => { button.Opacity = enabled ? 0.3 : 0; @@ -176,7 +178,7 @@ public void SetDebugMode(bool enabled) private void HighlightElement(Polygon element, bool highlight) { - if (Properties.Settings.Default.IsDebugEnabled) + if (isDebugEnabled) { Application.Current.Dispatcher.Invoke(() => {