diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2017-02-01 07:54:20 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2017-02-01 07:54:20 +0100 |
| commit | 5ec3f1b688d9ae6838bd718cd1dfeffc634fa359 (patch) | |
| tree | 0c1ac27759dc5e65f9ec26ed9a349b8028013093 /src | |
| parent | 3d9ddabb58437ad829d29aacefa262100ef83e4b (diff) | |
popper separate content positionning
Diffstat (limited to 'src')
| -rw-r--r-- | src/GraphicObjects/Popper.cs | 16 |
1 files changed, 10 insertions, 6 deletions
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) |