]> O.S.I.I.S - jp/crow.git/commitdiff
test stacking orientation for contentSize of stack adjustments
authorjpbruyere <jp.bruyere@hotmail.com>
Tue, 2 Aug 2016 00:09:03 +0000 (02:09 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Tue, 2 Aug 2016 00:09:03 +0000 (02:09 +0200)
src/GraphicObjects/GraphicObject.cs

index 7a2e8ec54b30bf17686ce13a52b2a002e88247e4..865e664ce5df43ca6628bf3bb65792aff007cc21 100644 (file)
@@ -251,10 +251,12 @@ namespace Crow
                                        //we should adapt contentSize
                                        //TODO:check case when child become stretched, and another stretched item already exists.
                                        if (_parent is GenericStack) {//TODO:check if I should test Group instead
-                                               if (lastWP == Measure.Fit)
-                                                       (_parent as GenericStack).contentSize.Width -= this.LastSlots.Width;
-                                               else
-                                                       (_parent as GenericStack).contentSize.Width += this.LastSlots.Width;
+                                               if ((_parent as GenericStack).Orientation == Orientation.Horizontal) {
+                                                       if (lastWP == Measure.Fit)
+                                                               (_parent as GenericStack).contentSize.Width -= this.LastSlots.Width;
+                                                       else
+                                                               (_parent as GenericStack).contentSize.Width += this.LastSlots.Width;
+                                               }
                                        }
                                }
 
@@ -277,10 +279,12 @@ namespace Crow
                                if (HeightPolicy != lastHP) {
                                        NotifyValueChanged ("HeightPolicy", HeightPolicy);
                                        if (_parent is GenericStack) {
-                                               if (lastHP == Measure.Fit)
-                                                       (_parent as GenericStack).contentSize.Height -= this.LastSlots.Height;
-                                               else
-                                                       (_parent as GenericStack).contentSize.Height += this.LastSlots.Height;
+                                               if ((_parent as GenericStack).Orientation == Orientation.Vertical) {
+                                                       if (lastHP == Measure.Fit)
+                                                               (_parent as GenericStack).contentSize.Height -= this.LastSlots.Height;
+                                                       else
+                                                               (_parent as GenericStack).contentSize.Height += this.LastSlots.Height;
+                                               }
                                        }
                                }