From 593be72f21d68bd407ed2f8e7aa9fef10d365be4 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Wed, 1 Feb 2017 07:54:20 +0100 Subject: [PATCH] popper separate content positionning --- src/GraphicObjects/Popper.cs | 16 ++++++++++------ 1 file 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) -- 2.47.3