Add a deadzone for standard scrolling
This commit is contained in:
@@ -171,7 +171,7 @@ namespace OpenRA
|
|||||||
public float ViewportEdgeScrollStep = 10f;
|
public float ViewportEdgeScrollStep = 10f;
|
||||||
public float UIScrollSpeed = 50f;
|
public float UIScrollSpeed = 50f;
|
||||||
public int SelectionDeadzone = 24;
|
public int SelectionDeadzone = 24;
|
||||||
public int JoystickScrollDeadzone = 8;
|
public int MouseScrollDeadzone = 8;
|
||||||
|
|
||||||
public bool UseClassicMouseStyle = false;
|
public bool UseClassicMouseStyle = false;
|
||||||
public StatusBarsType StatusBars = StatusBarsType.Standard;
|
public StatusBarsType StatusBars = StatusBarsType.Standard;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public int EdgeCornerScrollThreshold = 35;
|
public int EdgeCornerScrollThreshold = 35;
|
||||||
|
|
||||||
int2? joystickScrollStart, joystickScrollEnd;
|
int2? joystickScrollStart, joystickScrollEnd;
|
||||||
|
int2? standardScrollStart;
|
||||||
bool isStandardScrolling;
|
bool isStandardScrolling;
|
||||||
|
|
||||||
static readonly Dictionary<ScrollDirection, string> ScrollCursors = new Dictionary<ScrollDirection, string>
|
static readonly Dictionary<ScrollDirection, string> ScrollCursors = new Dictionary<ScrollDirection, string>
|
||||||
@@ -235,7 +236,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
return joystickScrollStart.HasValue && joystickScrollEnd.HasValue &&
|
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 (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;
|
isStandardScrolling = true;
|
||||||
var d = scrollType == MouseScrollType.Inverted ? -1 : 1;
|
var d = scrollType == MouseScrollType.Inverted ? -1 : 1;
|
||||||
@@ -297,6 +301,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
var wasStandardScrolling = isStandardScrolling;
|
var wasStandardScrolling = isStandardScrolling;
|
||||||
isStandardScrolling = false;
|
isStandardScrolling = false;
|
||||||
|
standardScrollStart = null;
|
||||||
|
|
||||||
if (wasStandardScrolling)
|
if (wasStandardScrolling)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user