Browse Source

Fix another problem in layout.

If an arrange pass causes measure invalidate, exit the arrange pass and
re-run the measure pass.
pull/10/head
Steven Kirk 12 years ago
parent
commit
462d40156a
  1. 28
      Perspex.Layout/LayoutManager.cs

28
Perspex.Layout/LayoutManager.cs

@ -95,13 +95,21 @@ namespace Perspex.Layout
{ {
this.LayoutQueued = false; this.LayoutQueued = false;
if (this.measureNeeded) for (int i = 0; i < MaxTries; ++i)
{ {
this.ExecuteMeasure(); if (this.measureNeeded)
this.measureNeeded = false; {
} this.ExecuteMeasure();
this.measureNeeded = false;
}
this.ExecuteArrange(); this.ExecuteArrange();
if (this.toMeasure.Count == 0)
{
break;
}
}
} }
/// <summary> /// <summary>
@ -199,6 +207,11 @@ namespace Perspex.Layout
this.Root.Arrange(new Rect(this.Root.ClientSize)); this.Root.Arrange(new Rect(this.Root.ClientSize));
} }
if (this.toMeasure.Count > 0)
{
return;
}
foreach (var item in arrange) foreach (var item in arrange)
{ {
if (!item.Control.IsArrangeValid) if (!item.Control.IsArrangeValid)
@ -213,6 +226,11 @@ namespace Perspex.Layout
} }
control.Arrange(control.PreviousArrange.Value, true); control.Arrange(control.PreviousArrange.Value, true);
if (this.toMeasure.Count > 0)
{
return;
}
} }
} }
} }

Loading…
Cancel
Save