From ffb4036fe0573c35e759cb89e8b252f5477ecbea Mon Sep 17 00:00:00 2001 From: Teemu Suo-Anttila Date: Mon, 8 Jun 2015 13:44:34 +0300 Subject: Fix Grid drag selection with scrolled page (#17895) Change-Id: I1303781c5a996448e12e86835935702686af3ab7 --- .../grid/selection/MultiSelectionRenderer.java | 26 +++------------------- 1 file changed, 3 insertions(+), 23 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java b/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java index c8a7ceeca3..1e47d3ad6b 100644 --- a/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java +++ b/client/src/com/vaadin/client/widget/grid/selection/MultiSelectionRenderer.java @@ -535,10 +535,8 @@ public class MultiSelectionRenderer extends final int topBorder = getBodyClientTop(); final int bottomBorder = getBodyClientBottom(); - final int scrollCompensation = getScrollCompensation(); - topBound = scrollCompensation + topBorder + SCROLL_AREA_GRADIENT_PX; - bottomBound = scrollCompensation + bottomBorder - - SCROLL_AREA_GRADIENT_PX; + topBound = topBorder + SCROLL_AREA_GRADIENT_PX; + bottomBound = bottomBorder - SCROLL_AREA_GRADIENT_PX; gradientArea = SCROLL_AREA_GRADIENT_PX; // modify bounds if they're too tightly packed @@ -551,17 +549,6 @@ public class MultiSelectionRenderer extends } } - private int getScrollCompensation() { - Element cursor = grid.getElement(); - int scroll = 0; - while (cursor != null) { - scroll -= cursor.getScrollTop(); - cursor = cursor.getParentElement(); - } - - return scroll; - } - public void stop() { if (handlerRegistration != null) { handlerRegistration.removeHandler(); @@ -743,15 +730,8 @@ public class MultiSelectionRenderer extends } /** Get the "top" of an element in relation to "client" coordinates. */ - @SuppressWarnings("static-method") private int getClientTop(final Element e) { - Element cursor = e; - int top = 0; - while (cursor != null) { - top += cursor.getOffsetTop(); - cursor = cursor.getOffsetParent(); - } - return top; + return e.getAbsoluteTop(); } private int getBodyClientBottom() { -- cgit v1.2.3