Java Code Examples for com.google.gwt.dom.client.Element#getScrollWidth()
The following examples show how to use
com.google.gwt.dom.client.Element#getScrollWidth() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CellBrowser.java From consulo with Apache License 2.0 | 6 votes |
void scrollToEnd() { Element elem = getElement(); targetScrollLeft = elem.getScrollWidth() - elem.getClientWidth(); if (LocaleInfo.getCurrentLocale().isRTL()) { targetScrollLeft *= -1; } if (isAnimationEnabled()) { // Animate the scrolling. startScrollLeft = elem.getScrollLeft(); run(250, elem); } else { // Scroll instantly. onComplete(); } }
Example 2
Source File: DomUtil.java From jetpad-projectional-open-source with Apache License 2.0 | 6 votes |
public static Rectangle visiblePart(Element ctx, Rectangle rect) { while (true) { if (ctx.getOffsetParent() == null) { Rectangle visibleArea = new Rectangle(Window.getScrollLeft(), Window.getScrollTop(), Window.getClientWidth(), Window.getClientHeight()); return visibleArea.intersect(rect); } else { Rectangle visible; if (hasScroller(ctx)) { visible = new Rectangle(0, 0, ctx.getClientWidth(), ctx.getClientHeight()); Vector scroll = new Vector(ctx.getScrollLeft(), ctx.getScrollTop()); rect = rect.sub(scroll); } else { visible = new Rectangle(0, 0, ctx.getScrollWidth(), ctx.getScrollHeight()); } Rectangle newRect = visible.intersect(rect); Vector offset = new Vector(ctx.getOffsetLeft(), ctx.getOffsetTop()); ctx = ctx.getOffsetParent(); rect = newRect.add(offset); } } }
Example 3
Source File: VLayoutDragDropMouseHandler.java From cuba with Apache License 2.0 | 5 votes |
private boolean isEventOnScrollBar(NativeEvent event) { Element element = Element.as(event.getEventTarget()); ; if (WidgetUtil.mayHaveScrollBars(element)) { final int nativeScrollbarSize = WidgetUtil.getNativeScrollbarSize(); int x = WidgetUtil.getTouchOrMouseClientX(event) - element.getAbsoluteLeft(); int y = WidgetUtil.getTouchOrMouseClientY(event) - element.getAbsoluteTop(); // Hopefully we have horizontal scroll. final int scrollWidth = element.getScrollWidth(); final int clientWidth = element.getClientWidth(); if (scrollWidth > clientWidth && clientWidth - nativeScrollbarSize < x) { return true; } // Hopefully we have vertical scroll. final int scrollHeight = element.getScrollHeight(); final int clientHeight = element.getClientHeight(); if (scrollHeight > clientHeight && clientHeight - nativeScrollbarSize < y) { return true; } } return false; }
Example 4
Source File: Scrolling.java From jetpad-projectional-open-source with Apache License 2.0 | 5 votes |
private static Rectangle getBounds(Element element) { int x = element.getAbsoluteLeft(); int y = element.getAbsoluteTop(); int width = element.getScrollWidth(); int height = element.getScrollHeight(); return new Rectangle(x, y, width, height); }