Merge pull request #11941 from obrakmann/fix11940-std-scrolling-deadzone
Fix mouse input breakage
This commit is contained in:
@@ -171,7 +171,7 @@ namespace OpenRA
|
||||
public float ViewportEdgeScrollStep = 10f;
|
||||
public float UIScrollSpeed = 50f;
|
||||
public int SelectionDeadzone = 24;
|
||||
public int JoystickScrollDeadzone = 8;
|
||||
public int MouseScrollDeadzone = 8;
|
||||
|
||||
public bool UseClassicMouseStyle = false;
|
||||
public StatusBarsType StatusBars = StatusBarsType.Standard;
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
public int EdgeCornerScrollThreshold = 35;
|
||||
|
||||
int2? joystickScrollStart, joystickScrollEnd;
|
||||
int2? standardScrollStart;
|
||||
bool isStandardScrolling;
|
||||
|
||||
static readonly Dictionary<ScrollDirection, string> ScrollCursors = new Dictionary<ScrollDirection, string>
|
||||
@@ -209,7 +210,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
public override string GetCursor(int2 pos)
|
||||
{
|
||||
if (!IsJoystickScrolling &&
|
||||
if (!(IsJoystickScrolling || isStandardScrolling) &&
|
||||
(!Game.Settings.Game.ViewportEdgeScroll || Ui.MouseOverWidget != this))
|
||||
return null;
|
||||
|
||||
@@ -235,7 +236,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
get
|
||||
{
|
||||
return joystickScrollStart.HasValue && joystickScrollEnd.HasValue &&
|
||||
(joystickScrollStart.Value - joystickScrollEnd.Value).Length > Game.Settings.Game.JoystickScrollDeadzone;
|
||||
(joystickScrollStart.Value - joystickScrollEnd.Value).Length > Game.Settings.Game.MouseScrollDeadzone;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +287,10 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
if (scrollType == MouseScrollType.Standard || scrollType == MouseScrollType.Inverted)
|
||||
{
|
||||
if (mi.Event == MouseInputEvent.Move)
|
||||
if (mi.Event == MouseInputEvent.Down && !isStandardScrolling)
|
||||
standardScrollStart = mi.Location;
|
||||
else if (mi.Event == MouseInputEvent.Move && (isStandardScrolling ||
|
||||
(standardScrollStart.HasValue && ((standardScrollStart.Value - mi.Location).Length > Game.Settings.Game.MouseScrollDeadzone))))
|
||||
{
|
||||
isStandardScrolling = true;
|
||||
var d = scrollType == MouseScrollType.Inverted ? -1 : 1;
|
||||
@@ -297,6 +301,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
var wasStandardScrolling = isStandardScrolling;
|
||||
isStandardScrolling = false;
|
||||
standardScrollStart = null;
|
||||
|
||||
if (wasStandardScrolling)
|
||||
return true;
|
||||
@@ -315,7 +320,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
if (mi.Event == MouseInputEvent.Up)
|
||||
{
|
||||
var wasJoystickScrolling = joystickScrollStart.HasValue && joystickScrollEnd.HasValue;
|
||||
var wasJoystickScrolling = IsJoystickScrolling;
|
||||
|
||||
joystickScrollStart = joystickScrollEnd = null;
|
||||
YieldMouseFocus(mi);
|
||||
|
||||
Reference in New Issue
Block a user