Skip to content

Commit

Permalink
MInor performance increase
Browse files Browse the repository at this point in the history
  • Loading branch information
Leapward-Koex committed Apr 16, 2024
1 parent 5b10418 commit fabead4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion TouchPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -168,6 +169,7 @@ private void DeselectAllItems()

public void SetDebugMode(bool enabled)
{
isDebugEnabled = enabled;
buttons.ForEach(button =>
{
button.Opacity = enabled ? 0.3 : 0;
Expand All @@ -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(() =>
{
Expand Down

0 comments on commit fabead4

Please sign in to comment.