Skip to content
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

Focus the ViewportController on Standard/Inverted scroll modes. #13812

Merged
merged 1 commit into from Aug 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions OpenRA.Mods.Common/Widgets/ViewportControllerWidget.cs
Expand Up @@ -308,7 +308,12 @@ public override bool HandleMouseInput(MouseInput mi)
if (scrollType == MouseScrollType.Standard || scrollType == MouseScrollType.Inverted)
{
if (mi.Event == MouseInputEvent.Down && !isStandardScrolling)
{
if (!TakeMouseFocus(mi))
return false;

standardScrollStart = mi.Location;
}
else if (mi.Event == MouseInputEvent.Move && (isStandardScrolling ||
(standardScrollStart.HasValue && ((standardScrollStart.Value - mi.Location).Length > Game.Settings.Game.MouseScrollDeadzone))))
{
Expand All @@ -322,6 +327,7 @@ public override bool HandleMouseInput(MouseInput mi)
var wasStandardScrolling = isStandardScrolling;
isStandardScrolling = false;
standardScrollStart = null;
YieldMouseFocus(mi);

if (wasStandardScrolling)
return true;
Expand All @@ -335,6 +341,7 @@ public override bool HandleMouseInput(MouseInput mi)
{
if (!TakeMouseFocus(mi))
return false;

joystickScrollStart = mi.Location;
}

Expand Down