From 454268a740dd26eefffbbae645e5ed9681527308 Mon Sep 17 00:00:00 2001 From: KillzXGaming Date: Sat, 15 Feb 2020 19:13:41 -0500 Subject: [PATCH] Improve the color dialog more --- .../Forms/Color/VertexColorBox.cs | 31 ++++++++++--------- .../Forms/Dialogs/STColorDialog.cs | 2 +- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Switch_Toolbox_Library/Forms/Color/VertexColorBox.cs b/Switch_Toolbox_Library/Forms/Color/VertexColorBox.cs index 927cb84f..e2b32594 100644 --- a/Switch_Toolbox_Library/Forms/Color/VertexColorBox.cs +++ b/Switch_Toolbox_Library/Forms/Color/VertexColorBox.cs @@ -131,26 +131,29 @@ namespace Toolbox.Library.Forms if (e.Button == MouseButtons.Left) { - mouseLoc = e.Location; - this.Invalidate(); + if (!dialogActive) { + mouseLoc = e.Location; + this.Invalidate(); + } + if (TopLeftHit.IsHit(e.Location)) LoadColorDialog(TopLeftColor, 0); - if (TopRightHit.IsHit(e.Location)) + else if (TopRightHit.IsHit(e.Location)) LoadColorDialog(TopRightColor, 1); - if (BottomLeftHit.IsHit(e.Location)) + else if (BottomLeftHit.IsHit(e.Location)) LoadColorDialog(BottomLeftColor, 2); - if (BottomRightHit.IsHit(e.Location)) + else if (BottomRightHit.IsHit(e.Location)) LoadColorDialog(BottomRightColor, 3); - if (TopHit.IsHit(e.Location)) + else if (TopHit.IsHit(e.Location)) LoadColorDialogSides(TopRightColor, TopLeftColor, 0); - if (BottomHit.IsHit(e.Location)) + else if (BottomHit.IsHit(e.Location)) LoadColorDialogSides(BottomRightColor, BottomLeftColor, 1); - if (RightHit.IsHit(e.Location)) + else if (RightHit.IsHit(e.Location)) LoadColorDialogSides(TopRightColor, BottomRightColor, 2); - if (LeftHit.IsHit(e.Location)) + else if (LeftHit.IsHit(e.Location)) LoadColorDialogSides(TopLeftColor, BottomLeftColor, 3); - if (AllHit.IsHit(e.Location)) + else if (AllHit.IsHit(e.Location)) { if (dialogActive) { @@ -164,8 +167,8 @@ namespace Toolbox.Library.Forms colorDlg.FormClosed += delegate { mouseLoc = Point.Empty; - this.Invalidate(); dialogActive = false; + this.Invalidate(); }; colorDlg.ColorChanged += delegate { @@ -182,8 +185,6 @@ namespace Toolbox.Library.Forms }; } } - - this.Invalidate(); } private void LoadColorDialogSides(Color color1, Color color2, int index) @@ -208,8 +209,8 @@ namespace Toolbox.Library.Forms colorDlg.FormClosed += delegate { mouseLoc = Point.Empty; - this.Invalidate(); dialogActive = false; + this.Invalidate(); }; colorDlg.Show(); colorDlg.ColorChanged += delegate @@ -250,8 +251,8 @@ namespace Toolbox.Library.Forms colorDlg.FormClosed += delegate { mouseLoc = Point.Empty; - this.Invalidate(); dialogActive = false; + this.Invalidate(); }; colorDlg.Show(); colorDlg.ColorChanged += delegate diff --git a/Switch_Toolbox_Library/Forms/Dialogs/STColorDialog.cs b/Switch_Toolbox_Library/Forms/Dialogs/STColorDialog.cs index 1a29f385..400f5b16 100644 --- a/Switch_Toolbox_Library/Forms/Dialogs/STColorDialog.cs +++ b/Switch_Toolbox_Library/Forms/Dialogs/STColorDialog.cs @@ -29,7 +29,7 @@ namespace Toolbox.Library.Forms //Wait until the user can lose focus for closing control //This prevents window from popping up and closing instantly - Utils.DelayAction(2000,delegate + Utils.DelayAction(100,delegate { CanCloseOnLostFocus = true; });