From 3fbad3c8ac99a8de575caf6d7c9962812f3aa473 Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Sat, 13 Feb 2021 22:59:06 +0100 Subject: [PATCH] More fixes for erroneously being able to select object multiple times when paint selecting --- .../VisualModes/BaseVisualGeometrySector.cs | 19 ++++++++++++------- .../VisualModes/BaseVisualGeometrySidedef.cs | 19 ++++++++++++------- .../VisualModes/BaseVisualThing.cs | 19 ++++++++++++------- 3 files changed, 36 insertions(+), 21 deletions(-) diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs index b897c7a5..67fcbdce 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySector.cs @@ -461,23 +461,28 @@ namespace CodeImp.DoomBuilder.BuilderModes { if (General.Interface.ShiftState ^ BuilderPlug.Me.AdditivePaintSelect) { - this.selected = true; - mode.AddSelectedObject(this); + if (!selected) + { + selected = true; + mode.AddSelectedObject(this); + } } else if (General.Interface.CtrlState) { - this.selected = false; - mode.RemoveSelectedObject(this); - + if (selected) + { + selected = false; + mode.RemoveSelectedObject(this); + } } else { - if (this.selected) + if (selected) mode.RemoveSelectedObject(this); else mode.AddSelectedObject(this); - this.selected = !this.selected; + selected = !selected; } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs index ad93d9d3..fdd7ef11 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualGeometrySidedef.cs @@ -1433,23 +1433,28 @@ namespace CodeImp.DoomBuilder.BuilderModes // toggle selected state if (General.Interface.ShiftState ^ BuilderPlug.Me.AdditivePaintSelect) { - this.selected = true; - mode.AddSelectedObject(this); + if (!selected) + { + selected = true; + mode.AddSelectedObject(this); + } } else if (General.Interface.CtrlState) { - this.selected = false; - mode.RemoveSelectedObject(this); - + if (selected) + { + selected = false; + mode.RemoveSelectedObject(this); + } } else { - if (this.selected) + if (selected) mode.RemoveSelectedObject(this); else mode.AddSelectedObject(this); - this.selected = !this.selected; + selected = !selected; } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs index 03288c29..7055ccef 100755 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualThing.cs @@ -878,23 +878,28 @@ namespace CodeImp.DoomBuilder.BuilderModes { if (General.Interface.ShiftState ^ BuilderPlug.Me.AdditivePaintSelect) { - this.selected = true; - mode.AddSelectedObject(this); + if (!selected) + { + selected = true; + mode.AddSelectedObject(this); + } } else if (General.Interface.CtrlState) { - this.selected = false; - mode.RemoveSelectedObject(this); - + if (selected) + { + selected = false; + mode.RemoveSelectedObject(this); + } } else { - if (this.selected) + if (selected) mode.RemoveSelectedObject(this); else mode.AddSelectedObject(this); - this.selected = !this.selected; + selected = !selected; } } }