final int endBorder = getBodyClientEnd();
startBorder += getFrozenColumnsWidth();
- final int scrollCompensation = getScrollCompensation();
- startingBound = scrollCompensation + startBorder + scrollAreaPX;
- endingBound = scrollCompensation + endBorder - scrollAreaPX;
+ startingBound = startBorder + scrollAreaPX;
+ endingBound = endBorder - scrollAreaPX;
gradientArea = scrollAreaPX;
// modify bounds if they're too tightly packed
}
}
- private int getScrollCompensation() {
- Element cursor = grid.getElement();
- int scroll = 0;
- while (cursor != null) {
- scroll -= scrollDirection == ScrollAxis.VERTICAL ? cursor
- .getScrollTop() : cursor.getScrollLeft();
- cursor = cursor.getParentElement();
- }
-
- return scroll;
- }
-
private void injectNativeHandler() {
removeNativeHandler();
nativePreviewHandlerRegistration = Event
}
}
- private TableSectionElement getTbodyElement() {
- TableElement table = getTableElement();
- if (table != null) {
- return table.getTBodies().getItem(0);
- } else {
- return null;
- }
- }
-
private TableSectionElement getTheadElement() {
TableElement table = getTableElement();
if (table != null) {
}
}
- /** 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;
- }
-
- /** Get the "left" of an element in relation to "client" coordinates. */
- @SuppressWarnings("static-method")
- private int getClientLeft(final Element e) {
- Element cursor = e;
- int left = 0;
- while (cursor != null) {
- left += cursor.getOffsetLeft();
- cursor = cursor.getOffsetParent();
- }
- return left;
- }
-
private int getBodyClientEnd() {
if (scrollDirection == ScrollAxis.VERTICAL) {
- return getClientTop(getTfootElement()) - 1;
+ return getTfootElement().getAbsoluteTop() - 1;
} else {
- TableSectionElement tbodyElement = getTbodyElement();
- return getClientLeft(tbodyElement) + tbodyElement.getOffsetWidth()
- - 1;
+ return getTableElement().getAbsoluteRight();
}
}
private int getBodyClientStart() {
if (scrollDirection == ScrollAxis.VERTICAL) {
- return getClientTop(grid.getElement())
- + getTheadElement().getOffsetHeight();
+ return getTheadElement().getAbsoluteBottom() + 1;
} else {
- return getClientLeft(getTbodyElement());
+ return getTableElement().getAbsoluteLeft();
}
}
// scrolled to the right
if (latestColumnDropIndex == visibleColumns
&& rightBoundaryForDrag < dropMarkerLeft
- && dropMarkerLeft <= escalator.getHeader().getElement()
- .getOffsetWidth()) {
+ && dropMarkerLeft <= escalator.getInnerWidth()) {
dropMarkerLeft = rightBoundaryForDrag - dropMarkerWidthOffset;
}
// Check if the drop marker shouldn't be shown at all
else if (dropMarkerLeft < frozenColumnsWidth
- || dropMarkerLeft > Math
- .min(rightBoundaryForDrag, escalator.getHeader()
- .getElement().getOffsetWidth())
- || dropMarkerLeft < 0) {
+ || dropMarkerLeft > Math.min(rightBoundaryForDrag,
+ escalator.getInnerWidth()) || dropMarkerLeft < 0) {
dropMarkerLeft = -10000000;
}
dropMarker.getStyle().setLeft(dropMarkerLeft, Unit.PX);
// Do not show the drag element beyond the grid
final double sidebarBoundary = getSidebarBoundaryComparedTo(left);
- final int gridBoundary = escalator.getHeader().getElement()
- .getOffsetWidth();
+ final double gridBoundary = escalator.getInnerWidth();
final double rightBoundary = Math
.min(sidebarBoundary, gridBoundary);