Browse Source

Cache Margin in MeasureCore.

pull/386/head
Steven Kirk 11 years ago
parent
commit
7925fa8c65
  1. 6
      src/Perspex.Layout/Layoutable.cs

6
src/Perspex.Layout/Layoutable.cs

@ -446,11 +446,13 @@ namespace Perspex.Layout
{ {
if (IsVisible) if (IsVisible)
{ {
var margin = Margin;
ApplyTemplate(); ApplyTemplate();
var constrained = LayoutHelper var constrained = LayoutHelper
.ApplyLayoutConstraints(this, availableSize) .ApplyLayoutConstraints(this, availableSize)
.Deflate(Margin); .Deflate(margin);
var measured = MeasureOverride(constrained); var measured = MeasureOverride(constrained);
var width = measured.Width; var width = measured.Width;
@ -472,7 +474,7 @@ namespace Perspex.Layout
height = Math.Min(height, MaxHeight); height = Math.Min(height, MaxHeight);
height = Math.Max(height, MinHeight); height = Math.Max(height, MinHeight);
return NonNegative(new Size(width, height).Inflate(Margin)); return NonNegative(new Size(width, height).Inflate(margin));
} }
else else
{ {

Loading…
Cancel
Save