MInor performance increase

pull/7/head
LeapwardKoex 2024-04-16 21:19:50 +12:00
parent 5b10418f1a
commit fabead4e65
1 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,7 @@ public partial class TouchPanel : Window
private readonly Dictionary<int, Polygon> activeTouches = [];
private readonly TouchPanelPositionManager _positionManager;
private List<Polygon> buttons = [];
private bool isDebugEnabled = Properties.Settings.Default.IsDebugEnabled;
private enum ResizeDirection
{
@ -168,6 +169,7 @@ public partial class TouchPanel : Window
public void SetDebugMode(bool enabled)
{
isDebugEnabled = enabled;
buttons.ForEach(button =>
{
button.Opacity = enabled ? 0.3 : 0;
@ -176,7 +178,7 @@ public partial class TouchPanel : Window
private void HighlightElement(Polygon element, bool highlight)
{
if (Properties.Settings.Default.IsDebugEnabled)
if (isDebugEnabled)
{
Application.Current.Dispatcher.Invoke(() =>
{