From 02ac8178673249c2d1af60d7b291d8b40419bcd8 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Sat, 30 Apr 2016 13:03:33 +0200 Subject: glfw backend, group measure on change only --- src/GraphicObjects/GenericStack.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/GraphicObjects/GenericStack.cs') diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index d5ff81c6..adf428c5 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -50,11 +50,18 @@ namespace Crow } protected override int measureRawSize (LayoutingType lt) { + int totSpace = 0; + for (int i = 0; i < Children.Count; i++) { + if (Children [i].Visible) + totSpace += Spacing; + } + if (totSpace > 0) + totSpace -= Spacing; if (lt == LayoutingType.Width) { if (Orientation == Orientation.Horizontal) - return contentSize.Width + (Children.Count - 1) * Spacing + 2 * Margin; + return contentSize.Width + totSpace + 2 * Margin; }else if (Orientation == Orientation.Vertical) - return contentSize.Height + (Children.Count - 1) * Spacing + 2 * Margin; + return contentSize.Height + totSpace + 2 * Margin; return base.measureRawSize (lt); } @@ -103,7 +110,7 @@ namespace Crow public override void OnChildLayoutChanges (object sender, LayoutingEventArgs arg) { GraphicObject go = sender as GraphicObject; - Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString()); + //Debug.WriteLine ("child layout change: " + go.LastSlots.ToString() + " => " + go.Slot.ToString()); switch (arg.LayoutType) { case LayoutingType.Width: if (Orientation == Orientation.Horizontal) { -- cgit v1.3.1-4-g156e