diff --git a/OpenRA.Game/Widgets/SliderWidget.cs b/OpenRA.Game/Widgets/SliderWidget.cs index e450fe7fe4..8b746d1070 100755 --- a/OpenRA.Game/Widgets/SliderWidget.cs +++ b/OpenRA.Game/Widgets/SliderWidget.cs @@ -21,7 +21,8 @@ namespace OpenRA.Widgets public int Ticks = 0; public int TrackHeight = 5; - public float2 Range = new float2(0f, 1f); + public float MinimumValue = 0; + public float MaximumValue = 1; public float Value = 0; protected bool isMoving = false; @@ -33,14 +34,15 @@ namespace OpenRA.Widgets { OnChange = other.OnChange; Ticks = other.Ticks; - Range = other.Range; + MinimumValue = other.MinimumValue; + MaximumValue = other.MaximumValue; Value = other.Value; TrackHeight = other.TrackHeight; } void UpdateValue(float newValue) { - Value = newValue.Clamp(Range.X, Range.Y); + Value = newValue.Clamp(MinimumValue, MaximumValue); OnChange(Value); } @@ -74,8 +76,8 @@ namespace OpenRA.Widgets return ThumbRect.Contains(mi.Location); } - float ValueFromPx(int x) { return Range.X + (Range.Y - Range.X) * (1f * x / RenderBounds.Width); } - int PxFromValue(float x) { return (int)(RenderBounds.Width * (x - Range.X) / (Range.Y - Range.X)); } + float ValueFromPx(int x) { return MinimumValue + (MaximumValue - MinimumValue) * (1f * x / RenderBounds.Width); } + int PxFromValue(float x) { return (int)(RenderBounds.Width * (x - MinimumValue) / (MaximumValue - MinimumValue)); } public override Widget Clone() { return new SliderWidget(this); } diff --git a/mods/cnc/chrome/dropdowns.yaml b/mods/cnc/chrome/dropdowns.yaml index 219d9f59de..25f41676a2 100644 --- a/mods/cnc/chrome/dropdowns.yaml +++ b/mods/cnc/chrome/dropdowns.yaml @@ -71,7 +71,8 @@ Background@COLOR_CHOOSER: Width:160 Height:20 Ticks:5 - Range:0.2,1 + MinimumValue: 0.2 + MaximumValue: 1 ScrollPanel@LABEL_DROPDOWN_TEMPLATE: Id:LABEL_DROPDOWN_TEMPLATE @@ -135,4 +136,4 @@ ScrollPanel@TEAM_DROPDOWN_TEMPLATE: X:0 Width:PARENT_RIGHT Height:25 - Align:Center \ No newline at end of file + Align:Center diff --git a/mods/cnc/chrome/preferences.yaml b/mods/cnc/chrome/preferences.yaml index 39e334b659..eea1141397 100644 --- a/mods/cnc/chrome/preferences.yaml +++ b/mods/cnc/chrome/preferences.yaml @@ -240,7 +240,8 @@ Container@SETTINGS_PANEL: Width:240 Height:20 Ticks:5 - Range:10,50 + MinimumValue: 10 + MaximumValue: 50 Checkbox@EDGESCROLL_CHECKBOX: Id:EDGESCROLL_CHECKBOX X:15 @@ -338,4 +339,4 @@ Container@SETTINGS_PANEL: Y:249 Width:140 Height:35 - Text:Back \ No newline at end of file + Text:Back diff --git a/mods/ra/chrome/gamelobby.yaml b/mods/ra/chrome/gamelobby.yaml index 88be930c0b..b172e9a726 100644 --- a/mods/ra/chrome/gamelobby.yaml +++ b/mods/ra/chrome/gamelobby.yaml @@ -493,7 +493,8 @@ Background@COLOR_CHOOSER: Width:160 Height:20 Ticks:5 - Range:0.2,1 + MinimumValue: 0.2 + MaximumValue: 1 Label@RANGE_LABEL: X:0 Y:80 @@ -508,7 +509,8 @@ Background@COLOR_CHOOSER: Width:160 Height:20 Ticks:5 - Range:0,0.25 + MinimumValue: 0 + MaximumValue: 0.25 Background@MAP_CHOOSER: Id:MAP_CHOOSER X:(WINDOW_RIGHT - WIDTH)/2 @@ -714,4 +716,4 @@ Background@MAP_CHOOSER: Width:120 Height:25 Text:Cancel - Font:Bold \ No newline at end of file + Font:Bold diff --git a/mods/ra/chrome/settings.yaml b/mods/ra/chrome/settings.yaml index aa3b7f7089..e66bc45795 100644 --- a/mods/ra/chrome/settings.yaml +++ b/mods/ra/chrome/settings.yaml @@ -102,7 +102,8 @@ Background@SETTINGS_MENU: Width:250 Height:20 Ticks:5 - Range:10,50 + MinimumValue: 10 + MaximumValue: 50 Checkbox@INVERSE_SCROLL: Id:INVERSE_SCROLL X:0