From 967f9bbeca46517f3d94d1eb4b04a3e36c8a31f0 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Mon, 7 Sep 2015 16:19:58 +0200 Subject: Dynamic layouting debug and improvments --- src/GraphicObjects/GenericStack.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/GraphicObjects/GenericStack.cs') diff --git a/src/GraphicObjects/GenericStack.cs b/src/GraphicObjects/GenericStack.cs index fc7aa247..2f9aede9 100644 --- a/src/GraphicObjects/GenericStack.cs +++ b/src/GraphicObjects/GenericStack.cs @@ -68,13 +68,13 @@ namespace go if (Orientation == Orientation.Horizontal) { foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) { tmp.Width += c.Slot.Width + Spacing; - tmp.Height = Math.Max (tmp.Height, c.Slot.Bottom); + tmp.Height = Math.Max (tmp.Height, Math.Max(c.Slot.Bottom, c.Slot.Height)); } if (tmp.Width > 0) tmp.Width -= Spacing; } else { foreach (GraphicObject c in Children.Where(ch=>ch.Visible)) { - tmp.Width = Math.Max (tmp.Width, c.Slot.Right); + tmp.Width = Math.Max (tmp.Width, Math.Max(c.Slot.Right, c.Slot.Width)); tmp.Height += c.Slot.Height + Spacing; } if (tmp.Height > 0) @@ -125,13 +125,13 @@ namespace go else if (gobjs.Length == 1) { int sz = Children.Where(ch=>ch.Visible).Except (gobjs).Sum (g => g.Slot.Width); if (sz < Slot.Width) { - gobjs [0].Slot.Width = Slot.Width - sz - (Children.Count-1) * Spacing; + gobjs [0].Slot.Width = Slot.Width - sz - (Children.Count-1) * Spacing - 2 * Margin; int idx = Children.IndexOf (gobjs [0]); if (idx > 0 && idx < Children.Count - 1) gobjs [0].Slot.Width -= Spacing; if (gobjs [0].LastSlots.Width != gobjs [0].Slot.Width) { gobjs [0].bmp = null; - //gobjs [0].OnLayoutChanges (LayoutingType.Width); + gobjs [0].OnLayoutChanges (LayoutingType.Width); gobjs [0].LastSlots.Width = gobjs [0].Slot.Width; } } @@ -145,12 +145,13 @@ namespace go else if (gobjs.Length == 1) { int sz = Children.Where(ch=>ch.Visible).Except (gobjs).Sum (g => g.Slot.Height); if (sz < Slot.Height) { - gobjs [0].Slot.Height = Slot.Height - sz- (Children.Count-1) * Spacing; + gobjs [0].Slot.Height = Slot.Height - sz- (Children.Count-1) * Spacing - 2 * Margin; int idx = Children.IndexOf (gobjs [0]); if (idx > 0 && idx < Children.Count - 1) gobjs [0].Slot.Height -= Spacing; if (gobjs [0].LastSlots.Height != gobjs [0].Slot.Height) { gobjs [0].bmp = null; + gobjs [0].OnLayoutChanges (LayoutingType.Height); gobjs [0].LastSlots.Height = gobjs [0].Slot.Height; } } -- cgit v1.3.1-4-g156e