feat: :pressed, comparison.

This commit is contained in:
Zhang Dian
2024-01-22 15:15:51 +08:00
parent 5964108da0
commit d2f01c1257
3 changed files with 11 additions and 4 deletions

View File

@@ -22,7 +22,9 @@ public class RangeTrack: Control
public const string PC_Vertical = ":vertical";
private double _density;
private Vector _lastDrag;
private const double Tolerance = 0.0001;
public static readonly StyledProperty<double> MinimumProperty = AvaloniaProperty.Register<RangeTrack, double>(
nameof(Minimum), coerce: CoerceMinimum, defaultBindingMode:BindingMode.TwoWay);
@@ -165,7 +167,7 @@ public class RangeTrack: Control
{
var oldValue = args.OldValue.Value;
var newValue = args.NewValue.Value;
if (oldValue != newValue)
if (Math.Abs(oldValue - newValue) > Tolerance)
{
RaiseEvent(new RangeValueChangedEventArgs(ValueChangedEvent, this, oldValue, newValue, isLower));
}