From 22b924c8fe6f7fa261cc6a8b3b915523bbaad7be Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 6 Sep 2015 05:27:11 +0000 Subject: [PATCH] Large DisplayPopup issues behaviour improved git-svn-id: svn://ultimatepp.org/upp/trunk@8894 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlLib/LabelBase.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/uppsrc/CtrlLib/LabelBase.cpp b/uppsrc/CtrlLib/LabelBase.cpp index 6c95c7d57..cc1295233 100644 --- a/uppsrc/CtrlLib/LabelBase.cpp +++ b/uppsrc/CtrlLib/LabelBase.cpp @@ -548,7 +548,8 @@ void DisplayPopup::Sync() r.right = max(r.right, r.left + sz.cx + 2 * margin); r.bottom = max(r.bottom, r.top + sz.cy); r.Inflate(1, 1); - r.Offset(ctrl->GetScreenView().TopLeft()); + Rect v = ctrl->GetScreenView(); + r.Offset(v.TopLeft()); Rect wa = GetWorkArea(r.BottomLeft()); Size sz = r.GetSize(); @@ -567,8 +568,12 @@ void DisplayPopup::Sync() } else if(r.bottom > wa.bottom) { - r.top = max(wa.top, wa.bottom - sz.cy); - r.bottom = wa.bottom; + if(wa.bottom - r.top < r.top - wa.top) { // there is more space upside + r.bottom = item.bottom + v.top; + r.top = max(wa.top, r.bottom - sz.cy); + } + else + r.bottom = wa.bottom; } SetRect(r);