本文整理了Java中com.google.gwt.dom.client.Element.getScrollLeft()
方法的一些代码示例,展示了Element.getScrollLeft()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getScrollLeft()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getScrollLeft
[英]The number of pixels that an element's content is scrolled from the left.
If the element is in RTL mode, this method will return a negative value of the number of pixels scrolled from the right.
[中]元素内容从左侧滚动的像素数。
如果元素处于RTL模式,此方法将返回从右侧滚动的像素数的负值。
代码示例来源:origin: com.google.gwt/gwt-servlet
public int getScrollLeft(Document doc) {
return ensureDocumentScrollingElement(doc).getScrollLeft();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public int getHorizontalScrollPosition() {
return getScrollableElement().getScrollLeft();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the touch x-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
public final int getRelativeX(Element target) {
return getClientX() - target.getAbsoluteLeft() + target.getScrollLeft()
+ target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the mouse x-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
public int getRelativeX(Element target) {
NativeEvent e = getNativeEvent();
return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void onScroll(ScrollEvent event) {
Widget source = getSource(event);
Element elem = source.getElement();
getListener().onScroll(getSource(event), elem.getScrollLeft(),
elem.getScrollTop());
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
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();
}
}
}
代码示例来源:origin: threerings/playn
/**
* Gets the event's x-position relative to a given element.
*
* @param e native event
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
static float getRelativeX(NativeEvent e, Element target) {
return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft()
+ target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
}
代码示例来源:origin: io.playn/playn-html
/**
* Gets the event's x-position relative to a given element.
*
* @param e native event
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
static float getRelativeX (NativeEvent e, Element target) {
return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Gets the touch x-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
public final int getRelativeX(Element target) {
return getClientX() - target.getAbsoluteLeft() + target.getScrollLeft()
+ target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: playn/playn
/**
* Gets the event's x-position relative to a given element.
*
* @param e native event
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
static float getRelativeX (NativeEvent e, Element target) {
return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Gets the touch x-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
public final int getRelativeX(Element target) {
return getClientX() - target.getAbsoluteLeft() + target.getScrollLeft()
+ target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets
@Test
public void testOnScroll() {
reset(element);
when(element.getScrollTop()).thenReturn(100);
when(element.getScrollLeft()).thenReturn(200);
tested.onScroll(scrollEvent);
verify(paletteStyle, times(1)).setTop(100, Style.Unit.PX);
verify(paletteStyle, times(1)).setLeft(200, Style.Unit.PX);
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Gets the mouse x-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
public int getRelativeX(Element target) {
NativeEvent e = getNativeEvent();
return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Gets the mouse x-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative x-position
*/
public int getRelativeX(Element target) {
NativeEvent e = getNativeEvent();
return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets
@EventHandler("sessionContainer")
protected void onScroll(@ForEvent("scroll") ScrollEvent e) {
// on the editor scroll recalculate palette position to be fixed on the screen
palettePanel.getElement().getStyle().setTop(paletteInitialTop + e.getRelativeElement().getScrollTop(),
Style.Unit.PX);
palettePanel.getElement().getStyle().setLeft(paletteInitialLeft + e.getRelativeElement().getScrollLeft(),
Style.Unit.PX);
e.preventDefault();
}
代码示例来源:origin: net.wetheinter/gwt-user
public void onScroll(ScrollEvent event) {
Widget source = getSource(event);
Element elem = source.getElement();
getListener().onScroll(getSource(event), elem.getScrollLeft(),
elem.getScrollTop());
}
}
代码示例来源:origin: org.uberfire/uberfire-wires-core-grids
public static int getRelativeXOfEvent(final DomEvent event) {
final NativeEvent e = event.getNativeEvent();
final Element target = event.getRelativeElement();
return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client
private int getRelativeX(final ContextMenuEvent event) {
final NativeEvent e = event.getNativeEvent();
final Element target = event.getRelativeElement();
return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft();
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
public void onScroll(ScrollEvent event) {
Widget source = getSource(event);
Element elem = source.getElement();
getListener().onScroll(getSource(event), elem.getScrollLeft(),
elem.getScrollTop());
}
}
代码示例来源:origin: org.geomajas.hammergwt/geomajas-project-hammer-gwt
/**
* Get relative x position on the page.
* @return x position in pixels
*/
public final int getRelativeX() {
NativeEvent e = getNativeEvent();
Element target = getTarget();
return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft();
}
内容来源于网络,如有侵权,请联系作者删除!