From abc7966f196389ff158e1a1765a0342779e5fe22 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 15 Sep 2017 19:43:38 +0200 Subject: [PATCH] Fixed issues with offsets when the window-manager has a toolbar that consumes space and prevents overlap. --- src/dorkbox/notify/LookAndFeel.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/dorkbox/notify/LookAndFeel.java b/src/dorkbox/notify/LookAndFeel.java index e2b2997..573e1a8 100644 --- a/src/dorkbox/notify/LookAndFeel.java +++ b/src/dorkbox/notify/LookAndFeel.java @@ -301,14 +301,22 @@ class LookAndFeel { // the popups are ALL the same size! // popups at TOP grow down, popups at BOTTOM grow up int targetY; + int prevTargetY; // this is to determine if there is an offset as a result of a toolbar/etc int anchorX = sourceLook.anchorX; int anchorY = sourceLook.anchorY; - if (isShowFromTop(sourceLook)) { - targetY = anchorY + (popupIndex * (NotifyCanvas.HEIGHT + 10)); - } - else { - targetY = anchorY - (popupIndex * (NotifyCanvas.HEIGHT + 10)); + + if (popupIndex == 0) { + targetY = anchorY; + } else { + int previousY = looks.get(popupIndex - 1).getParentY(); + + if (isShowFromTop(sourceLook)) { + targetY = previousY + (NotifyCanvas.HEIGHT + 10); + } + else { + targetY = previousY - (NotifyCanvas.HEIGHT + 10); + } } looks.add(sourceLook);