aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/GenericStack.cs
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-04-30 13:03:33 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-04-30 13:03:33 +0200
commit02ac8178673249c2d1af60d7b291d8b40419bcd8 (patch)
tree672b1242b2d31ed159916ed32b99147279fcc758 /src/GraphicObjects/GenericStack.cs
parent8771dccd2369447a50485c7649e8a0851b551958 (diff)
glfw backend, group measure on change only
Diffstat (limited to 'src/GraphicObjects/GenericStack.cs')
-rw-r--r--src/GraphicObjects/GenericStack.cs13
1 files changed, 10 insertions, 3 deletions
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) {