aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-02-17 01:18:24 +0100
committerjpbruyere <jp.bruyere@hotmail.com>2016-02-17 01:18:24 +0100
commite34113064b1ebd1859b16f8f79f0f6e0da4b7ad2 (patch)
treee0fe2003b99c71a820f84c9ad83655b46d4ade3a /src
parent7e1fde10929505c741a86cba3cc7643bc149a498 (diff)
force first child of group in Fit to Fit if no other child could be sized
Diffstat (limited to 'src')
-rw-r--r--src/GraphicObjects/Group.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs
index 2a960029..6e2417a9 100644
--- a/src/GraphicObjects/Group.cs
+++ b/src/GraphicObjects/Group.cs
@@ -127,17 +127,26 @@ namespace Crow
}
protected override int measureRawSize (LayoutingType lt)
{
+ if (Children.Count == 0)
+ return base.measureRawSize (lt);
+
if (lt == LayoutingType.Width) {
if (largestChild == null)
searchLargestChild ();
- if (largestChild == null)//if still null, not possible to determine a width
- return -1;
+ if (largestChild == null){
+ //if still null, not possible to determine a width
+ //because all children are stretched, force first one to fit
+ Children[0].Width = -1;
+ return -1;//cancel actual sizing to let child computation take place
+ }
return maxChildrenWidth + 2 * Margin;
}else{
if (tallestChild == null)
searchTallestChild ();
- if (tallestChild == null)
+ if (tallestChild == null) {
+ Children[0].Height = -1;
return -1;
+ }
return maxChildrenHeight + 2 * Margin;
}
}