diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-07 16:19:58 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2015-09-07 16:19:58 +0200 |
| commit | 967f9bbeca46517f3d94d1eb4b04a3e36c8a31f0 (patch) | |
| tree | d6fb1e98074c85ecdb934c964da8418c16652baf /src/GraphicObjects | |
| parent | ac08ff01dbc59628a94a6e09cd0aff07f588f05f (diff) | |
Dynamic layouting debug and improvments
Diffstat (limited to 'src/GraphicObjects')
| -rw-r--r-- | src/GraphicObjects/GenericStack.cs | 11 | ||||
| -rw-r--r-- | src/GraphicObjects/Group.cs | 6 | ||||
| -rw-r--r-- | src/GraphicObjects/Window.cs | 4 |
3 files changed, 13 insertions, 8 deletions
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;
}
}
diff --git a/src/GraphicObjects/Group.cs b/src/GraphicObjects/Group.cs index 41294231..b21598c9 100644 --- a/src/GraphicObjects/Group.cs +++ b/src/GraphicObjects/Group.cs @@ -125,6 +125,9 @@ namespace go int crw = ClientRectangle.Width;
foreach (GraphicObject c in Children.Where(ch => ch.Slot.Width != crw && ch.Visible))
c.RegisterForLayouting ((int)LayoutingType.X);
+ } else {
+ foreach (GraphicObject c in Children.Where(ch => ch.Width == 0 && ch.Visible))
+ c.RegisterForLayouting ((int)LayoutingType.Width);
}
break;
case LayoutingType.Height:
@@ -132,6 +135,9 @@ namespace go int crh = ClientRectangle.Height;
foreach (GraphicObject c in Children.Where(ch => ch.Slot.Height != crh && ch.Visible))
c.RegisterForLayouting ((int)LayoutingType.Y);
+ } else {
+ foreach (GraphicObject c in Children.Where(ch => ch.Height == 0 && ch.Visible))
+ c.RegisterForLayouting ((int)LayoutingType.Height);
}
break;
}
diff --git a/src/GraphicObjects/Window.cs b/src/GraphicObjects/Window.cs index d7988c92..c1a117eb 100644 --- a/src/GraphicObjects/Window.cs +++ b/src/GraphicObjects/Window.cs @@ -150,9 +150,7 @@ namespace go this.Width += e.XDelta; this.Height += e.YDelta; break; - } - - this.RegisterForLayouting ((int)LayoutingType.All); + } } public override void onMouseLeave (object sender, MouseMoveEventArgs e) { |