]> O.S.I.I.S - jp/crow.git/commitdiff
go.UpdateLayout position improvment
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 17 Mar 2018 03:28:49 +0000 (04:28 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 18 Mar 2018 14:52:57 +0000 (15:52 +0100)
src/GraphicObjects/GenericStack.cs
src/GraphicObjects/GraphicObject.cs

index 9bf1944a7497f46e8a8b21392e7f1a6ea92dff26..2653d4204c0571604c19d55883a36b56b84774f2 100644 (file)
@@ -267,11 +267,11 @@ namespace Crow
                        else                            
                                adjustStretchedGo (LayoutingType.Height);                       
                }
-//             public override void LayoutingDiscardCheck (LayoutingType lt)
-//             {
-//                     if ((lt == LayoutingType.Height && _orientation == Orientation.Horizontal) ||
-//                             (lt == LayoutingType.Width && _orientation == Orientation.Vertical))
-//                             base.LayoutingDiscardCheck (lt);
-//             }
+               public override void LayoutingDiscardCheck (LayoutingType lt)
+               {
+                       if ((lt == LayoutingType.Height && _orientation == Orientation.Horizontal) ||
+                               (lt == LayoutingType.Width && _orientation == Orientation.Vertical))
+                               base.LayoutingDiscardCheck (lt);
+               }
        }
 }
index 1147f2082c3dee0a15883adb2770bab0241855d2..d1ae13c9d633afe4ed5f431c943cc8212d8dfdfb 100644 (file)
@@ -1500,22 +1500,15 @@ namespace Crow
                        case LayoutingType.X:
                                if (Visible) {
                                        if (Left == 0) {
-
-                                               if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
-                                                   RegisteredLayoutings.HasFlag (LayoutingType.Width))
-                                                       return false;
-
-                                               switch (HorizontalAlignment) {
-                                               case HorizontalAlignment.Left:
+                                               if (HorizontalAlignment == HorizontalAlignment.Left)
                                                        Slot.X = 0;
-                                                       break;
-                                               case HorizontalAlignment.Right:
+                                               else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Width) ||
+                                                       RegisteredLayoutings.HasFlag (LayoutingType.Width))
+                                                       return false;
+                                               else if (HorizontalAlignment == HorizontalAlignment.Right)
                                                        Slot.X = Parent.ClientRectangle.Width - Slot.Width;
-                                                       break;
-                                               case HorizontalAlignment.Center:
+                                               else if (HorizontalAlignment == HorizontalAlignment.Center)
                                                        Slot.X = Parent.ClientRectangle.Width / 2 - Slot.Width / 2;
-                                                       break;
-                                               }
                                        } else
                                                Slot.X = Left;
                                } else
@@ -1533,22 +1526,15 @@ namespace Crow
                        case LayoutingType.Y:
                                if (Visible) {
                                        if (Top == 0) {
-
-                                               if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) ||
-                                                   RegisteredLayoutings.HasFlag (LayoutingType.Height))
-                                                       return false;
-
-                                               switch (VerticalAlignment) {
-                                               case VerticalAlignment.Top://this could be processed even if parent Height is not known
+                                               if (VerticalAlignment == VerticalAlignment.Top)
                                                        Slot.Y = 0;
-                                                       break;
-                                               case VerticalAlignment.Bottom:
+                                               else if (Parent.RegisteredLayoutings.HasFlag (LayoutingType.Height) ||
+                                                       RegisteredLayoutings.HasFlag (LayoutingType.Height))
+                                                       return false;
+                                               else if (VerticalAlignment == VerticalAlignment.Bottom)
                                                        Slot.Y = Parent.ClientRectangle.Height - Slot.Height;
-                                                       break;
-                                               case VerticalAlignment.Center:
+                                               else if (VerticalAlignment == VerticalAlignment.Center)
                                                        Slot.Y = Parent.ClientRectangle.Height / 2 - Slot.Height / 2;
-                                                       break;
-                                               }
                                        } else
                                                Slot.Y = Top;
                                } else