fix: fix vertical bug.

This commit is contained in:
rabbitism
2024-01-19 18:36:19 +08:00
parent 236a44c62c
commit 33543c7ebf

View File

@@ -499,10 +499,11 @@ public class RangeTrack: Control
internal double GetRatioByPoint(double position) internal double GetRatioByPoint(double position)
{ {
bool isHorizontal = Orientation == Orientation.Horizontal; bool isHorizontal = Orientation == Orientation.Horizontal;
var range = LowerSection?.Bounds.Width + InnerSection?.Bounds.Width + UpperSection?.Bounds.Width ?? double.Epsilon; var range = isHorizontal?
LowerSection?.Bounds.Width + InnerSection?.Bounds.Width + UpperSection?.Bounds.Width ?? double.Epsilon
: LowerSection?.Bounds.Height + InnerSection?.Bounds.Height + UpperSection?.Bounds.Height ?? double.Epsilon;
if (isHorizontal) if (isHorizontal)
{ {
if (IsDirectionReversed) if (IsDirectionReversed)
{ {
double trackStart = UpperThumb?.Bounds.Width/2 ?? 0; double trackStart = UpperThumb?.Bounds.Width/2 ?? 0;