Clamp, scroll, scrollspeed, sliders

Reduced clamp duplication
Fixed scrolling speed issue
Modified scrollspeed slider to use a range
Fixed scrollspeed, volume, and sound sliders not showing current setting.
This commit is contained in:
Caleb Anderson
2010-10-06 02:37:20 -05:00
committed by Chris Forbes
parent ab431fe9ee
commit c85503811c
7 changed files with 21 additions and 31 deletions

View File

@@ -37,7 +37,7 @@ namespace OpenRA.Widgets
return Spread * Offset + Little;
};
OnChange = x => Offset = x;
OnChange = x => Offset = x.Clamp(0f, 1f);
}
public SliderWidget(SliderWidget other)
@@ -45,8 +45,9 @@ namespace OpenRA.Widgets
{
OnChange = other.OnChange;
GetOffset = other.GetOffset;
Offset = other.Offset;
Ticks = other.Ticks;
Range = other.Range;
Offset = GetOffset();
TrackHeight = other.TrackHeight;
lastMouseLocation = other.lastMouseLocation;
isMoving = other.isMoving;
@@ -58,7 +59,7 @@ namespace OpenRA.Widgets
var Little = Math.Min(Range.X, Range.Y);
var Spread = Big - Little;
Offset = (newOffset - Little) / Spread;
Offset = ((newOffset - Little) / Spread).Clamp(0f, 1f);
}
public override bool HandleInputInner(MouseInput mi)