Browse Source

Merge pull request #4255 from MarchingCube/fix-track-thumb-arrange

Fix hardcoded thumb min length
pull/4281/head
danwalmsley 6 years ago
committed by GitHub
parent
commit
f1a3b28af5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/Avalonia.Controls/Primitives/Track.cs

9
src/Avalonia.Controls/Primitives/Track.cs

@ -353,6 +353,15 @@ namespace Avalonia.Controls.Primitives
var trackLength = isVertical ? arrangeSize.Height : arrangeSize.Width; var trackLength = isVertical ? arrangeSize.Height : arrangeSize.Width;
double thumbMinLength = 10; double thumbMinLength = 10;
StyledProperty<double> minLengthProperty = isVertical ? MinHeightProperty : MinWidthProperty;
var thumb = Thumb;
if (thumb != null && thumb.IsSet(minLengthProperty))
{
thumbMinLength = thumb.GetValue(minLengthProperty);
}
thumbLength = trackLength * viewportSize / extent; thumbLength = trackLength * viewportSize / extent;
CoerceLength(ref thumbLength, trackLength); CoerceLength(ref thumbLength, trackLength);
thumbLength = Math.Max(thumbMinLength, thumbLength); thumbLength = Math.Max(thumbMinLength, thumbLength);

Loading…
Cancel
Save