]> O.S.I.I.S - jp/crow.git/commitdiff
popper separate content positionning
authorjpbruyere <jp.bruyere@hotmail.com>
Wed, 1 Feb 2017 06:54:20 +0000 (07:54 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Wed, 1 Feb 2017 06:54:20 +0000 (07:54 +0100)
src/GraphicObjects/Popper.cs

index 10d5d30ef9fd65cc0c6a22b30b13f2e1dd0d22ef..a90bef715a4a528fdebf924180a79543be00ba75 100644 (file)
@@ -126,14 +126,12 @@ namespace Crow
                                _content.LayoutChanged += _content_LayoutChanged;
                        }
                }
-
-               protected void _content_LayoutChanged (object sender, LayoutingEventArgs e)
-               {
+               void positionContent(LayoutingType lt){
                        ILayoutable tc = Content.Parent;
                        if (tc == null)
                                return;
                        Rectangle r = this.ScreenCoordinates (this.Slot);
-                       if (e.LayoutType.HasFlag(LayoutingType.Width)) {
+                       if (lt == LayoutingType.X) {
                                if (popDirection.HasFlag (Alignment.Right)) {
                                        if (r.Right + Content.Slot.Width > tc.ClientRectangle.Right)
                                                Content.Left = r.Left - Content.Slot.Width;
@@ -153,8 +151,7 @@ namespace Crow
                                        } else
                                                Content.Left = 0;
                                }
-                       }
-                       if (e.LayoutType.HasFlag(LayoutingType.Height)) {
+                       }else if (lt == LayoutingType.Y) {
                                if (Content.Slot.Height < tc.ClientRectangle.Height) {
                                        if (PopDirection.HasFlag (Alignment.Bottom)) {
                                                if (r.Bottom + Content.Slot.Height > tc.ClientRectangle.Bottom)
@@ -172,6 +169,13 @@ namespace Crow
                                        Content.Top = 0;
                        }
                }
+               protected void _content_LayoutChanged (object sender, LayoutingEventArgs e)
+               {
+                       if (e.LayoutType.HasFlag (LayoutingType.Width))
+                               positionContent (LayoutingType.X);
+                       if (e.LayoutType.HasFlag(LayoutingType.Height))
+                               positionContent (LayoutingType.Y);
+               }
 
                #region GraphicObject overrides
                public override void onMouseClick (object sender, MouseButtonEventArgs e)