Add Edge Scroll setting
This commit is contained in:
@@ -19,6 +19,9 @@ namespace OpenRA.GameRules
|
||||
{
|
||||
public class UserSettings
|
||||
{
|
||||
// Behaviour settings
|
||||
public bool ViewportEdgeScroll = true;
|
||||
|
||||
// Debug settings
|
||||
public bool PerfDebug = false;
|
||||
public bool RecordSyncReports = true;
|
||||
|
||||
@@ -46,6 +46,14 @@ namespace OpenRA.Widgets.Delegates
|
||||
};
|
||||
name.OnEnterKey = () => { name.LoseFocus(); return true; };
|
||||
|
||||
var edgeScroll = general.GetWidget<CheckboxWidget>("EDGE_SCROLL");
|
||||
edgeScroll.Checked = () => Game.Settings.ViewportEdgeScroll;
|
||||
edgeScroll.OnMouseDown = mi =>
|
||||
{
|
||||
Game.Settings.ViewportEdgeScroll ^= true;
|
||||
return true;
|
||||
};
|
||||
|
||||
// Audio
|
||||
var audio = bg.GetWidget("AUDIO_PANE");
|
||||
|
||||
|
||||
@@ -31,9 +31,6 @@ namespace OpenRA.Widgets
|
||||
class ViewportScrollControllerWidget : Widget
|
||||
{
|
||||
public int EdgeScrollThreshold = 15;
|
||||
public bool EdgeScroll = true;
|
||||
public bool KeyboardScroll = true;
|
||||
public bool MouseScroll = true;
|
||||
|
||||
ScrollDirection Keyboard;
|
||||
ScrollDirection Edge;
|
||||
@@ -44,9 +41,6 @@ namespace OpenRA.Widgets
|
||||
|
||||
public override bool HandleInputInner(MouseInput mi)
|
||||
{
|
||||
if (!MouseScroll)
|
||||
return false;
|
||||
|
||||
if (mi.Event == MouseInputEvent.Move &&
|
||||
(mi.Button == MouseButton.Middle || mi.Button == (MouseButton.Left | MouseButton.Right)))
|
||||
{
|
||||
@@ -58,7 +52,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public override string GetCursor(int2 pos)
|
||||
{
|
||||
if (!EdgeScroll)
|
||||
if (!Game.Settings.ViewportEdgeScroll)
|
||||
return null;
|
||||
|
||||
if (Edge.Includes(ScrollDirection.Up) && Edge.Includes(ScrollDirection.Left))
|
||||
@@ -90,9 +84,6 @@ namespace OpenRA.Widgets
|
||||
|
||||
public override bool HandleKeyPressInner(KeyInput e)
|
||||
{
|
||||
if (!KeyboardScroll)
|
||||
return false;
|
||||
|
||||
switch (e.KeyName)
|
||||
{
|
||||
case "up": Keyboard = Keyboard.Set(ScrollDirection.Up, (e.Event == KeyInputEvent.Down)); return true;
|
||||
@@ -106,7 +97,7 @@ namespace OpenRA.Widgets
|
||||
public override void Tick(World world)
|
||||
{
|
||||
Edge = ScrollDirection.None;
|
||||
if (EdgeScroll)
|
||||
if (Game.Settings.ViewportEdgeScroll)
|
||||
{
|
||||
// Check for edge-scroll
|
||||
if (Widget.LastMousePos.X < EdgeScrollThreshold)
|
||||
|
||||
@@ -86,6 +86,13 @@ Container@ROOT:
|
||||
X:90
|
||||
Y:0
|
||||
MaxLength:16
|
||||
Checkbox@EDGE_SCROLL:
|
||||
Id:EDGE_SCROLL
|
||||
X:0
|
||||
Y:30
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Enable Edge Scrolling
|
||||
Container@AUDIO_PANE:
|
||||
Id:AUDIO_PANE
|
||||
X:37
|
||||
|
||||
@@ -86,6 +86,13 @@ Container@ROOT:
|
||||
X:90
|
||||
Y:0
|
||||
MaxLength:16
|
||||
Checkbox@EDGE_SCROLL:
|
||||
Id:EDGE_SCROLL
|
||||
X:0
|
||||
Y:30
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Enable Edge Scrolling
|
||||
Container@AUDIO_PANE:
|
||||
Id:AUDIO_PANE
|
||||
X:37
|
||||
|
||||
Reference in New Issue
Block a user