maxValue = value;
NotifyValueChangedAuto (maxValue);
+
+ if (Value > maxValue)
+ Value = maxValue;
+
registerUpdate ();
}
}
smallStep = value;
NotifyValueChangedAuto (smallStep);
+
+ if (Value < minValue)
+ Value = minValue;
+
registerUpdate ();
}
}
actualValue = minValue;
else if (value > maxValue)
actualValue = maxValue;
- else
+ else
actualValue = value;
actualValue = Math.Round (actualValue, decimals);
protected virtual void registerUpdate ()
=> RegisterForRedraw ();
-
+
protected virtual void onUp (object sender, MouseButtonEventArgs e)
{
if (IFace.Ctrl)
public virtual Orientation Orientation
{
get { return _orientation; }
- set {
+ set {
if (_orientation == value)
return;
- _orientation = value;
+ _orientation = value;
RegisterForLayouting (LayoutingType.All);
NotifyValueChangedAuto (_orientation);
public override bool ArrangeChildren => true;
public override bool UpdateLayout (LayoutingType layoutType)
{
- if (layoutType == LayoutingType.ArrangeChildren)
+ if (layoutType == LayoutingType.ArrangeChildren)
computeCursorPosition ();
-
+
return base.UpdateLayout (layoutType);
}
}
public override void onMouseMove (object sender, MouseMoveEventArgs e)
{
- if (holdCursor) {
+ if (holdCursor) {
Point m = ScreenPointToLocal (e.Position) - mouseDownInit;
Rectangle r = cursor.Parent.ClientRectangle;
if (_orientation == Orientation.Horizontal) {
if (r.Width - cursorSize == 0)
- return;
+ return;
double unit = (Maximum - Minimum) / (double)(r.Width - cursorSize);
if (inverted)
unit = -unit;
Value = tmp;
} else {
if (r.Height - cursorSize == 0)
- return;
+ return;
double unit = (Maximum - Minimum) / (double)(r.Height - cursorSize);
if (inverted)
unit = -unit;
double tmp = mouseDownInitValue + (double)m.Y * unit;
tmp -= tmp % SmallIncrement;
Value = tmp;
- }
+ }
}
e.Handled = true;
-
+
base.onMouseMove (sender, e);
}
#endregion