From d6a6ed28c8da0792d12b089acd74436234626931 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Thu, 25 Aug 2016 13:25:30 +0200 Subject: [PATCH 1/4] Fix issuing orders when releasing RMB after joystick-scrolling --- OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index 1b5fd7a7a0..6fd0057d0a 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -305,7 +305,7 @@ namespace OpenRA.Mods.Common.Widgets if (mi.Event == MouseInputEvent.Up) { - var wasJoystickScrolling = IsJoystickScrolling; + var wasJoystickScrolling = joystickScrollStart.HasValue && joystickScrollEnd.HasValue; joystickScrollStart = joystickScrollEnd = null; YieldMouseFocus(mi); From 1f2d046d3406977ef08f1e4224f9b3f5e67c2fd2 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Fri, 26 Aug 2016 10:40:27 +0200 Subject: [PATCH 2/4] Fix issuing orders when releasing RMB after standard-scrolling --- OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index 6fd0057d0a..b9424f0dfc 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Widgets public int EdgeCornerScrollThreshold = 35; int2? joystickScrollStart, joystickScrollEnd; + bool isStandardScrolling; static readonly Dictionary ScrollCursors = new Dictionary { @@ -287,10 +288,19 @@ namespace OpenRA.Mods.Common.Widgets { if (mi.Event == MouseInputEvent.Move) { + isStandardScrolling = true; var d = scrollType == MouseScrollType.Inverted ? -1 : 1; worldRenderer.Viewport.Scroll((Viewport.LastMousePos - mi.Location) * d, false); return true; } + else if (mi.Event == MouseInputEvent.Up) + { + var wasStandardScrolling = isStandardScrolling; + isStandardScrolling = false; + + if (wasStandardScrolling) + return true; + } } // Tiberian Sun style click-and-drag scrolling From dffb602ed4b10d3e4c703cc3af281ea7537ec3d4 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sat, 27 Aug 2016 13:56:09 +0200 Subject: [PATCH 3/4] Show scroll cursor when standard-scrolling using RMB --- OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs index b9424f0dfc..7eb3aa5e59 100644 --- a/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs @@ -215,7 +215,7 @@ namespace OpenRA.Mods.Common.Widgets var blockedDirections = worldRenderer.Viewport.GetBlockedDirections(); - if (IsJoystickScrolling) + if (IsJoystickScrolling || isStandardScrolling) { foreach (var dir in JoystickCursors) if (blockedDirections.Includes(dir.Key)) From d14ff2a54ee7e5343b0c0ea38e8d416d147e43f4 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 28 Aug 2016 11:26:23 +0200 Subject: [PATCH 4/4] Fix removing things in the editor when stopping standard-scrolling with RMB The cause for this was that the `HandleMouseInput` method of the `EditorViewPortController` ran before the one from the regular `ViewPortController`, thus intercepting the button press. Switching the order of the two around fixes that, but introduced another problem, namely that the tooltips stopped working. Switching the order meant that the `ViewPortController` laid "on top" of the `EditorViewPortController`, so the latter didn't receive the `MouseEntered` event anymore. Setting the `IgnoreMouseOver` flag in the `ViewPortController` fixes this. --- mods/cnc/chrome/editor.yaml | 7 ++++--- mods/ra/chrome/editor.yaml | 10 ++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/mods/cnc/chrome/editor.yaml b/mods/cnc/chrome/editor.yaml index 943bddbbab..e67fcd31a6 100644 --- a/mods/cnc/chrome/editor.yaml +++ b/mods/cnc/chrome/editor.yaml @@ -203,9 +203,6 @@ Container@EDITOR_WORLD_ROOT: Logic: LoadIngamePerfLogic, MapEditorLogic Children: Container@PERF_ROOT: - ViewportController: - Width: WINDOW_RIGHT - Height: WINDOW_BOTTOM EditorViewportController@MAP_EDITOR: Width: WINDOW_RIGHT Height: WINDOW_BOTTOM @@ -218,6 +215,10 @@ Container@EDITOR_WORLD_ROOT: Visible: false ActorPreview@DRAG_ACTOR_PREVIEW: Visible: false + ViewportController: + Width: WINDOW_RIGHT + Height: WINDOW_BOTTOM + IgnoreMouseOver: True Background@RADAR_BG: X: WINDOW_RIGHT-255 Y: 5 diff --git a/mods/ra/chrome/editor.yaml b/mods/ra/chrome/editor.yaml index fecc8bcfa8..a1d37314a0 100644 --- a/mods/ra/chrome/editor.yaml +++ b/mods/ra/chrome/editor.yaml @@ -194,12 +194,6 @@ Container@EDITOR_WORLD_ROOT: Logic: LoadIngamePerfLogic, MapEditorLogic Children: Container@PERF_ROOT: - ViewportController: - X: 0 - Y: 0 - Width: WINDOW_RIGHT - Height: WINDOW_BOTTOM - TooltipContainer: TOOLTIP_CONTAINER EditorViewportController@MAP_EDITOR: Width: WINDOW_RIGHT Height: WINDOW_BOTTOM @@ -212,6 +206,10 @@ Container@EDITOR_WORLD_ROOT: Visible: false Sprite@DRAG_LAYER_PREVIEW: Visible: false + ViewportController: + Width: WINDOW_RIGHT + Height: WINDOW_BOTTOM + IgnoreMouseOver: True Background@RADAR_BG: X: WINDOW_RIGHT-255 Y: 5