diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/src/com/vaadin/client/widgets/Grid.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java index 92827c47f0..07074eeddf 100644 --- a/client/src/com/vaadin/client/widgets/Grid.java +++ b/client/src/com/vaadin/client/widgets/Grid.java @@ -3541,24 +3541,26 @@ public class Grid<T> extends ResizeComposite implements private void resolveDragElementHorizontalPosition(final int clientX) { double left = clientX - table.getAbsoluteLeft(); - final double frozenColumnsWidth = getFrozenColumnsWidth(); - if (left < frozenColumnsWidth) { - left = (int) frozenColumnsWidth; - } - // do not show the drag element beyond a spanned header cell + // Do not show the drag element beyond a spanned header cell // limitation final Double leftBound = possibleDropPositions.firstKey(); final Double rightBound = possibleDropPositions.lastKey(); - double scrollLeft = getScrollLeft(); + final double scrollLeft = getScrollLeft(); if (left + scrollLeft < leftBound) { left = leftBound - scrollLeft + autoScrollX; } else if (left + scrollLeft > rightBound) { left = rightBound - scrollLeft + autoScrollX; } - // do not show the drag element beyond the grid - left = Math.max(0, Math.min(left, table.getClientWidth())); + // Do not show the drag element beyond the grid + final int bodyOffsetWidth = getEscalator().getBody().getElement() + .getOffsetWidth(); + // Do not show on left of the frozen columns (even if scrolled) + final int frozenColumnsWidth = (int) getFrozenColumnsWidth(); + + left = Math + .max(frozenColumnsWidth, Math.min(left, bodyOffsetWidth)); left -= dragElement.getClientWidth() / 2; dragElement.getStyle().setLeft(left, Unit.PX); |