Make sure the Slider can't step in increments of less than 1.

This commit is contained in:
The Dax 2014-05-05 23:52:10 -04:00
parent fbdf659723
commit 45f475675d

View File

@ -439,8 +439,12 @@ class Slider : public Clickable {
public:
Slider(int *value, int minValue, int maxValue, LayoutParams *layoutParams = 0)
: Clickable(layoutParams), value_(value), showPercent_(false), minValue_(minValue), maxValue_(maxValue), paddingLeft_(5), paddingRight_(70) {}
Slider(int *value, int minValue, int maxValue, int step = 1, LayoutParams *layoutParams = 0)
: Clickable(layoutParams), value_(value), showPercent_(false), minValue_(minValue), maxValue_(maxValue), paddingLeft_(5), paddingRight_(70), step_(step) {}
: Clickable(layoutParams), value_(value), showPercent_(false), minValue_(minValue), maxValue_(maxValue), paddingLeft_(5), paddingRight_(70), step_(step) {
if (step <= 0)
step_ = 1.0f;
}
virtual void Draw(UIContext &dc);
virtual void Key(const KeyInput &input);
virtual void Touch(const TouchInput &input);