From eb6df6fe623d1d74e053d3a065e090807d919eae Mon Sep 17 00:00:00 2001 From: teees Date: Tue, 3 Nov 2015 11:45:10 +0100 Subject: [PATCH 1/2] Handle mouse up event in default editor brush --- OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs index dc86985f34..b1ef3de1b2 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorDefaultBrush.cs @@ -55,12 +55,11 @@ namespace OpenRA.Mods.Common.Widgets { // Exclusively uses mouse wheel and right mouse buttons, but nothing else // Mouse move events are important for tooltips, so we always allow these through - if (mi.Button != MouseButton.Right && mi.Event != MouseInputEvent.Move && mi.Event != MouseInputEvent.Scroll) + if ((mi.Button != MouseButton.Right && mi.Event != MouseInputEvent.Move && mi.Event != MouseInputEvent.Scroll) || + mi.Event == MouseInputEvent.Down) return false; var cell = worldRenderer.Viewport.ViewToWorld(mi.Location); - if (mi.Event == MouseInputEvent.Up) - return true; var underCursor = editorLayer.PreviewsAt(worldRenderer.Viewport.ViewToWorldPx(mi.Location)) .FirstOrDefault(); From 2465344a2085412df50b3d32e12ded0e9eb210af Mon Sep 17 00:00:00 2001 From: teees Date: Tue, 3 Nov 2015 12:45:14 +0100 Subject: [PATCH 2/2] only change editor brushes on mouseup let other uses of the right mouse button bubble up --- OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs | 9 +++++++-- OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs | 9 +++++++-- OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs index fc7c7b483c..9b2d5a5c98 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorActorBrush.cs @@ -89,8 +89,13 @@ namespace OpenRA.Mods.Common.Widgets if (mi.Button == MouseButton.Right) { - editorWidget.ClearBrush(); - return true; + if (mi.Event == MouseInputEvent.Up) + { + editorWidget.ClearBrush(); + return true; + } + + return false; } var cell = worldRenderer.Viewport.ViewToWorld(mi.Location); diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs index 965d4285c6..d6182e68a6 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorResourceBrush.cs @@ -64,8 +64,13 @@ namespace OpenRA.Mods.Common.Widgets if (mi.Button == MouseButton.Right) { - editorWidget.ClearBrush(); - return true; + if (mi.Event == MouseInputEvent.Up) + { + editorWidget.ClearBrush(); + return true; + } + + return false; } var cell = worldRenderer.Viewport.ViewToWorld(mi.Location); diff --git a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs index c5f288c571..e0698219ad 100644 --- a/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs +++ b/OpenRA.Mods.Common/EditorBrushes/EditorTileBrush.cs @@ -64,8 +64,13 @@ namespace OpenRA.Mods.Common.Widgets if (mi.Button == MouseButton.Right) { - editorWidget.ClearBrush(); - return true; + if (mi.Event == MouseInputEvent.Up) + { + editorWidget.ClearBrush(); + return true; + } + + return false; } if (mi.Button == MouseButton.Left)