Merge pull request #11879 from obrakmann/fix11849_mousescrolling-order-trigger
Fix issuing orders when releasing RMB after joystick-scrolling
This commit is contained in:
@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public int EdgeCornerScrollThreshold = 35;
|
public int EdgeCornerScrollThreshold = 35;
|
||||||
|
|
||||||
int2? joystickScrollStart, joystickScrollEnd;
|
int2? joystickScrollStart, joystickScrollEnd;
|
||||||
|
bool isStandardScrolling;
|
||||||
|
|
||||||
static readonly Dictionary<ScrollDirection, string> ScrollCursors = new Dictionary<ScrollDirection, string>
|
static readonly Dictionary<ScrollDirection, string> ScrollCursors = new Dictionary<ScrollDirection, string>
|
||||||
{
|
{
|
||||||
@@ -214,7 +215,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
var blockedDirections = worldRenderer.Viewport.GetBlockedDirections();
|
var blockedDirections = worldRenderer.Viewport.GetBlockedDirections();
|
||||||
|
|
||||||
if (IsJoystickScrolling)
|
if (IsJoystickScrolling || isStandardScrolling)
|
||||||
{
|
{
|
||||||
foreach (var dir in JoystickCursors)
|
foreach (var dir in JoystickCursors)
|
||||||
if (blockedDirections.Includes(dir.Key))
|
if (blockedDirections.Includes(dir.Key))
|
||||||
@@ -287,10 +288,19 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
if (mi.Event == MouseInputEvent.Move)
|
if (mi.Event == MouseInputEvent.Move)
|
||||||
{
|
{
|
||||||
|
isStandardScrolling = true;
|
||||||
var d = scrollType == MouseScrollType.Inverted ? -1 : 1;
|
var d = scrollType == MouseScrollType.Inverted ? -1 : 1;
|
||||||
worldRenderer.Viewport.Scroll((Viewport.LastMousePos - mi.Location) * d, false);
|
worldRenderer.Viewport.Scroll((Viewport.LastMousePos - mi.Location) * d, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (mi.Event == MouseInputEvent.Up)
|
||||||
|
{
|
||||||
|
var wasStandardScrolling = isStandardScrolling;
|
||||||
|
isStandardScrolling = false;
|
||||||
|
|
||||||
|
if (wasStandardScrolling)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tiberian Sun style click-and-drag scrolling
|
// Tiberian Sun style click-and-drag scrolling
|
||||||
@@ -305,7 +315,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
if (mi.Event == MouseInputEvent.Up)
|
if (mi.Event == MouseInputEvent.Up)
|
||||||
{
|
{
|
||||||
var wasJoystickScrolling = IsJoystickScrolling;
|
var wasJoystickScrolling = joystickScrollStart.HasValue && joystickScrollEnd.HasValue;
|
||||||
|
|
||||||
joystickScrollStart = joystickScrollEnd = null;
|
joystickScrollStart = joystickScrollEnd = null;
|
||||||
YieldMouseFocus(mi);
|
YieldMouseFocus(mi);
|
||||||
|
|||||||
@@ -203,9 +203,6 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Logic: LoadIngamePerfLogic, MapEditorLogic
|
Logic: LoadIngamePerfLogic, MapEditorLogic
|
||||||
Children:
|
Children:
|
||||||
Container@PERF_ROOT:
|
Container@PERF_ROOT:
|
||||||
ViewportController:
|
|
||||||
Width: WINDOW_RIGHT
|
|
||||||
Height: WINDOW_BOTTOM
|
|
||||||
EditorViewportController@MAP_EDITOR:
|
EditorViewportController@MAP_EDITOR:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
@@ -218,6 +215,10 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Visible: false
|
Visible: false
|
||||||
ActorPreview@DRAG_ACTOR_PREVIEW:
|
ActorPreview@DRAG_ACTOR_PREVIEW:
|
||||||
Visible: false
|
Visible: false
|
||||||
|
ViewportController:
|
||||||
|
Width: WINDOW_RIGHT
|
||||||
|
Height: WINDOW_BOTTOM
|
||||||
|
IgnoreMouseOver: True
|
||||||
Background@RADAR_BG:
|
Background@RADAR_BG:
|
||||||
X: WINDOW_RIGHT-255
|
X: WINDOW_RIGHT-255
|
||||||
Y: 5
|
Y: 5
|
||||||
|
|||||||
@@ -194,12 +194,6 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Logic: LoadIngamePerfLogic, MapEditorLogic
|
Logic: LoadIngamePerfLogic, MapEditorLogic
|
||||||
Children:
|
Children:
|
||||||
Container@PERF_ROOT:
|
Container@PERF_ROOT:
|
||||||
ViewportController:
|
|
||||||
X: 0
|
|
||||||
Y: 0
|
|
||||||
Width: WINDOW_RIGHT
|
|
||||||
Height: WINDOW_BOTTOM
|
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
|
||||||
EditorViewportController@MAP_EDITOR:
|
EditorViewportController@MAP_EDITOR:
|
||||||
Width: WINDOW_RIGHT
|
Width: WINDOW_RIGHT
|
||||||
Height: WINDOW_BOTTOM
|
Height: WINDOW_BOTTOM
|
||||||
@@ -212,6 +206,10 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Visible: false
|
Visible: false
|
||||||
Sprite@DRAG_LAYER_PREVIEW:
|
Sprite@DRAG_LAYER_PREVIEW:
|
||||||
Visible: false
|
Visible: false
|
||||||
|
ViewportController:
|
||||||
|
Width: WINDOW_RIGHT
|
||||||
|
Height: WINDOW_BOTTOM
|
||||||
|
IgnoreMouseOver: True
|
||||||
Background@RADAR_BG:
|
Background@RADAR_BG:
|
||||||
X: WINDOW_RIGHT-255
|
X: WINDOW_RIGHT-255
|
||||||
Y: 5
|
Y: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user