|
@@ -135,6 +135,8 @@ internal partial class NumberInput : TextBox
|
|
|
private double _pressedValue;
|
|
|
private double _pressedRelativeX;
|
|
|
|
|
|
+ private double scrollBuildup;
|
|
|
+
|
|
|
static NumberInput()
|
|
|
{
|
|
|
ValueProperty.Changed.Subscribe(OnValueChanged);
|
|
@@ -347,15 +349,29 @@ internal partial class NumberInput : TextBox
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- int step = (int)e.Delta.Y;
|
|
|
+ e.Handled = true;
|
|
|
+ double requiredBuildup = 1;
|
|
|
+
|
|
|
+ if(Decimals == 0 && e.KeyModifiers.HasFlag(KeyModifiers.Control))
|
|
|
+ {
|
|
|
+ requiredBuildup = 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (Math.Abs(scrollBuildup) < requiredBuildup)
|
|
|
+ {
|
|
|
+ scrollBuildup += e.Delta.Y;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ double step = Math.Sign(e.Delta.Y);
|
|
|
|
|
|
double newValue = Value;
|
|
|
- if (e.KeyModifiers.HasFlag(KeyModifiers.Shift))
|
|
|
+ if (e.KeyModifiers.HasFlag(KeyModifiers.Shift) && Min - double.NegativeInfinity > 0.1f && Max - double.PositiveInfinity > 0.1f)
|
|
|
{
|
|
|
double multiplier = (Max - Min) * 0.1f;
|
|
|
newValue += step * multiplier;
|
|
|
}
|
|
|
- else if (e.KeyModifiers.HasFlag(KeyModifiers.Control))
|
|
|
+ else if (e.KeyModifiers.HasFlag(KeyModifiers.Control) && Decimals > 0)
|
|
|
{
|
|
|
newValue += step / 2f;
|
|
|
}
|
|
@@ -365,7 +381,8 @@ internal partial class NumberInput : TextBox
|
|
|
}
|
|
|
|
|
|
Value = (float)Math.Round(Math.Clamp(newValue, Min, Max), Decimals);
|
|
|
-
|
|
|
+
|
|
|
+ scrollBuildup = 0;
|
|
|
OnScrollAction?.Invoke();
|
|
|
}
|
|
|
|