]> O.S.I.I.S - jp/crow.git/commitdiff
prevent child positionning in a stack
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 6 Feb 2016 08:05:13 +0000 (09:05 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Sat, 6 Feb 2016 08:05:13 +0000 (09:05 +0100)
src/GraphicObjects/GraphicObject.cs

index 7927ccbeb86243b2f5d4fad337b726b9c453fc2d..e2ddf126d44d0da4cffceed0d2701498507e8e47 100644 (file)
@@ -512,6 +512,19 @@ namespace Crow
                public LayoutingType RegisteredLayoutings = 0;
 
                public virtual void RegisterForLayouting(LayoutingType layoutType){
+                       //Prevent child repositionning in a stack
+                       //TODO:this should be done inside GenericStack
+                       GenericStack gs = Parent as GenericStack;
+                       if (gs != null) {
+                               if (gs.Orientation == Orientation.Horizontal)
+                                       layoutType &= (~LayoutingType.X);
+                               else
+                                       layoutType &= (~LayoutingType.Y);
+
+                               if (layoutType == LayoutingType.None)
+                                       return;
+                       }
+
                        if (RegisteredLayoutings == LayoutingType.None)
                                Interface.RegisteredGOForLayouting.Enqueue (this);
                        RegisteredLayoutings |= (LayoutingType)layoutType;