replace Range with MinimumValue/MaximumValue
This commit is contained in:
@@ -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); }
|
||||
|
||||
|
||||
@@ -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
|
||||
Align:Center
|
||||
|
||||
@@ -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
|
||||
Text:Back
|
||||
|
||||
@@ -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
|
||||
Font:Bold
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user