Browse Source

Merge pull request #1204 from AvaloniaUI/fixes/invalid-rectangle-arrange-overide

[Scrollbar] dont try and arrange the thumb and buttons if the extent …
pull/1205/head
Steven Kirk 8 years ago
committed by GitHub
parent
commit
f9451bdf4e
  1. 24
      src/Avalonia.Controls/Primitives/Track.cs

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

@ -128,7 +128,17 @@ namespace Avalonia.Controls.Primitives
if (Orientation == Orientation.Horizontal)
{
var thumbWidth = double.IsNaN(viewportSize) ? thumb?.DesiredSize.Width ?? 0 : finalSize.Width * viewportSize / extent;
double thumbWidth = 0;
if (double.IsNaN(viewportSize))
{
thumbWidth = thumb?.DesiredSize.Width ?? 0;
}
else if (extent > 0)
{
thumbWidth = finalSize.Width * viewportSize / extent;
}
var remaining = finalSize.Width - thumbWidth;
var firstWidth = range <= 0 ? 0 : remaining * offset / range;
@ -149,7 +159,17 @@ namespace Avalonia.Controls.Primitives
}
else
{
var thumbHeight = double.IsNaN(viewportSize) ? thumb?.DesiredSize.Height ?? 0 : finalSize.Height * viewportSize / extent;
double thumbHeight = 0;
if (double.IsNaN(viewportSize))
{
thumbHeight = thumb?.DesiredSize.Height ?? 0;
}
else if (extent > 0)
{
thumbHeight = finalSize.Height * viewportSize / extent;
}
var remaining = finalSize.Height - thumbHeight;
var firstHeight = range <= 0 ? 0 : remaining * offset / range;

Loading…
Cancel
Save