Extract ViewportEdgeScrollMargin settings entry.

This commit is contained in:
Paul Chote
2017-08-09 22:18:43 +01:00
committed by abcdefg30
parent dd709a2679
commit d0d8062dbf
2 changed files with 7 additions and 6 deletions

View File

@@ -157,6 +157,8 @@ namespace OpenRA
public string Platform = "Default";
public bool ViewportEdgeScroll = true;
public int ViewportEdgeScrollMargin = 5;
public bool LockMouseWindow = false;
public MouseScrollType MiddleMouseScroll = MouseScrollType.Standard;
public MouseScrollType RightMouseScroll = MouseScrollType.Disabled;

View File

@@ -35,8 +35,6 @@ namespace OpenRA.Mods.Common.Widgets
public FrozenActor FrozenActorTooltip { get; private set; }
public ResourceType ResourceTooltip { get; private set; }
public int EdgeScrollThreshold = 5;
int2? joystickScrollStart, joystickScrollEnd;
int2? standardScrollStart;
bool isStandardScrolling;
@@ -474,14 +472,15 @@ namespace OpenRA.Mods.Common.Widgets
ScrollDirection CheckForDirections()
{
var margin = Game.Settings.Game.ViewportEdgeScrollMargin;
var directions = ScrollDirection.None;
if (Viewport.LastMousePos.X < EdgeScrollThreshold)
if (Viewport.LastMousePos.X < margin)
directions |= ScrollDirection.Left;
if (Viewport.LastMousePos.Y < EdgeScrollThreshold)
if (Viewport.LastMousePos.Y < margin)
directions |= ScrollDirection.Up;
if (Viewport.LastMousePos.X >= Game.Renderer.Resolution.Width - EdgeScrollThreshold)
if (Viewport.LastMousePos.X >= Game.Renderer.Resolution.Width - margin)
directions |= ScrollDirection.Right;
if (Viewport.LastMousePos.Y >= Game.Renderer.Resolution.Height - EdgeScrollThreshold)
if (Viewport.LastMousePos.Y >= Game.Renderer.Resolution.Height - margin)
directions |= ScrollDirection.Down;
return directions;