New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract ViewportEdgeScrollMargin settings entry. #13815

Merged
merged 1 commit into from Aug 10, 2017
Jump to file or symbol
Failed to load files and symbols.
+7 −6
Diff settings

Always

Just for now

View
@@ -157,6 +157,8 @@ public class GameSettings
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;
@@ -35,8 +35,6 @@ public class ViewportControllerWidget : Widget
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 @@ public override bool HandleKeyPress(KeyInput e)
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;
ProTip! Use n and p to navigate between commits in a pull request.