fix: fix vertical direction issue.
This commit is contained in:
@@ -305,26 +305,6 @@ public class RangeTrack: Control
|
|||||||
CoerceLength(ref lowerThumbLength, finalSize.Height);
|
CoerceLength(ref lowerThumbLength, finalSize.Height);
|
||||||
CoerceLength(ref upperThumbLength, finalSize.Height);
|
CoerceLength(ref upperThumbLength, finalSize.Height);
|
||||||
if (IsDirectionReversed)
|
if (IsDirectionReversed)
|
||||||
{
|
|
||||||
offset = offset.WithY(upperThumbLength * 0.5);
|
|
||||||
pieceSize = pieceSize.WithHeight(upperButtonLength);
|
|
||||||
UpperSection?.Arrange(new Rect(offset, pieceSize));
|
|
||||||
offset = offset.WithY(offset.Y + upperButtonLength);
|
|
||||||
pieceSize = pieceSize.WithHeight(innerButtonLength);
|
|
||||||
InnerSection?.Arrange(new Rect(offset, pieceSize));
|
|
||||||
offset = offset.WithY(offset.Y + innerButtonLength);
|
|
||||||
pieceSize = pieceSize.WithHeight(lowerButtonLength);
|
|
||||||
LowerSection?.Arrange(new Rect(offset, pieceSize));
|
|
||||||
|
|
||||||
offset = offset.WithY(upperButtonLength);
|
|
||||||
pieceSize = pieceSize.WithHeight(upperThumbLength);
|
|
||||||
UpperThumb?.Arrange(new Rect(offset, pieceSize));
|
|
||||||
|
|
||||||
offset = offset.WithY(upperButtonLength+innerButtonLength);
|
|
||||||
pieceSize = pieceSize.WithHeight(lowerThumbLength);
|
|
||||||
LowerThumb?.Arrange(new Rect(offset, pieceSize));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
offset = offset.WithY(lowerThumbLength * 0.5);
|
offset = offset.WithY(lowerThumbLength * 0.5);
|
||||||
pieceSize = pieceSize.WithHeight(lowerButtonLength);
|
pieceSize = pieceSize.WithHeight(lowerButtonLength);
|
||||||
@@ -344,6 +324,26 @@ public class RangeTrack: Control
|
|||||||
pieceSize = pieceSize.WithHeight(upperThumbLength);
|
pieceSize = pieceSize.WithHeight(upperThumbLength);
|
||||||
UpperThumb?.Arrange(new Rect(offset, pieceSize));
|
UpperThumb?.Arrange(new Rect(offset, pieceSize));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset = offset.WithY(upperThumbLength * 0.5);
|
||||||
|
pieceSize = pieceSize.WithHeight(upperButtonLength);
|
||||||
|
UpperSection?.Arrange(new Rect(offset, pieceSize));
|
||||||
|
offset = offset.WithY(offset.Y + upperButtonLength);
|
||||||
|
pieceSize = pieceSize.WithHeight(innerButtonLength);
|
||||||
|
InnerSection?.Arrange(new Rect(offset, pieceSize));
|
||||||
|
offset = offset.WithY(offset.Y + innerButtonLength);
|
||||||
|
pieceSize = pieceSize.WithHeight(lowerButtonLength);
|
||||||
|
LowerSection?.Arrange(new Rect(offset, pieceSize));
|
||||||
|
|
||||||
|
offset = offset.WithY(upperButtonLength);
|
||||||
|
pieceSize = pieceSize.WithHeight(upperThumbLength);
|
||||||
|
UpperThumb?.Arrange(new Rect(offset, pieceSize));
|
||||||
|
|
||||||
|
offset = offset.WithY(upperButtonLength + innerButtonLength);
|
||||||
|
pieceSize = pieceSize.WithHeight(lowerThumbLength);
|
||||||
|
LowerThumb?.Arrange(new Rect(offset, pieceSize));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -485,22 +485,22 @@ public class RangeTrack: Control
|
|||||||
{
|
{
|
||||||
if (IsDirectionReversed)
|
if (IsDirectionReversed)
|
||||||
{
|
{
|
||||||
double trackStart = UpperThumb?.Bounds.Height/2 ?? 0;
|
double trackStart = LowerThumb?.Bounds.Height / 2 ?? 0;
|
||||||
double trackEnd = trackStart + range;
|
|
||||||
if (position < trackStart) return 1.0;
|
|
||||||
if (position > trackEnd) return 0.0;
|
|
||||||
double diff = trackEnd - position;
|
|
||||||
return diff / range;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double trackStart = LowerThumb?.Bounds.Height/2 ?? 0;
|
|
||||||
double trackEnd = trackStart + range;
|
double trackEnd = trackStart + range;
|
||||||
if (position < trackStart) return 0.0;
|
if (position < trackStart) return 0.0;
|
||||||
if (position > trackEnd) return 1.0;
|
if (position > trackEnd) return 1.0;
|
||||||
double diff = position - trackStart;
|
double diff = position - trackStart;
|
||||||
return diff / range;
|
return diff / range;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double trackStart = UpperThumb?.Bounds.Height / 2 ?? 0;
|
||||||
|
double trackEnd = trackStart + range;
|
||||||
|
if (position < trackStart) return 1.0;
|
||||||
|
if (position > trackEnd) return 0.0;
|
||||||
|
double diff = trackEnd - position;
|
||||||
|
return diff / range;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user