Browse Source

Fix pointer interaction with reversed direction slider.

Previously dragging a slider with `IsDirectionRevered = true` resulted in the slider moving the wrong way.
pull/5729/head
Steven Kirk 6 years ago
parent
commit
38703b9423
  1. 4
      src/Avalonia.Controls/Slider.cs

4
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;

Loading…
Cancel
Save