Browse Source

Fix pointer interaction with reversed direction slider.

Previously dragging a slider with `IsDirectionRevered = true` resulted in the slider moving the wrong way.
Steven Kirk 4 years ago
parent
commit
38703b9423
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Avalonia.Controls/Slider.cs

+ 3 - 1
src/Avalonia.Controls/Slider.cs

@@ -341,7 +341,9 @@ namespace Avalonia.Controls
 
             var pointNum = orient ? x.Position.X : x.Position.Y;
             var logicalPos = MathUtilities.Clamp(pointNum / pointDen, 0.0d, 1.0d);
-            var invert = orient ? 0 : 1;
+            var invert = orient ? 
+                IsDirectionReversed ? 1 : 0 :
+                IsDirectionReversed ? 0 : 1;
             var calcVal = Math.Abs(invert - logicalPos);
             var range = Maximum - Minimum;
             var finalValue = calcVal * range + Minimum;