From aacb2f8289bc2faaab1225bd8b0dacd873d7839a Mon Sep 17 00:00:00 2001 From: Mika Murtojarvi Date: Wed, 5 Nov 2014 16:47:07 +0200 Subject: Position tooltips in the visible area (#15129). Change-Id: If4f13a859fd2e6fc363781bf04e52f780206e9e1 --- client/src/com/vaadin/client/VTooltip.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'client') diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java index edd1273bf5..2fb5a8a293 100644 --- a/client/src/com/vaadin/client/VTooltip.java +++ b/client/src/com/vaadin/client/VTooltip.java @@ -210,6 +210,10 @@ public class VTooltip extends VOverlay { x = Window.getClientWidth() - offsetWidth - MARGIN + Window.getScrollLeft(); } + // Do not allow x to be zero, for otherwise the tooltip does + // not close when the mouse is moved (see isTooltipOpen()). + int minX = Window.getScrollLeft() + MARGIN; + x = Math.max(x, minX); return x; } @@ -245,6 +249,10 @@ public class VTooltip extends VOverlay { y = Window.getScrollTop(); } } + // Do not allow y to be zero, for otherwise the tooltip does + // not close when the mouse is moved (see isTooltipOpen()). + int minY = Window.getScrollTop() + MARGIN; + y = Math.max(y, minY); return y; } }); -- cgit v1.2.3