From: jpbruyere Date: Wed, 1 Feb 2017 06:54:20 +0000 (+0100) Subject: popper separate content positionning X-Git-Tag: v0.9.5-beta~250 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=5ec3f1b688d9ae6838bd718cd1dfeffc634fa359;p=jp%2Fcrow.git popper separate content positionning --- diff --git a/src/GraphicObjects/Popper.cs b/src/GraphicObjects/Popper.cs index 10d5d30e..a90bef71 100644 --- a/src/GraphicObjects/Popper.cs +++ b/src/GraphicObjects/Popper.cs @@ -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)