本文整理了Java中com.google.gwt.dom.client.Element.getScrollTop()
方法的一些代码示例,展示了Element.getScrollTop()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getScrollTop()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getScrollTop
[英]The number of pixels that an element's content is scrolled from the top.
[中]元素内容从顶部滚动的像素数。
代码示例来源:origin: com.google.gwt/gwt-servlet
public int getVerticalScrollPosition() {
return getScrollableElement().getScrollTop();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public int getScrollTop(Document doc) {
return ensureDocumentScrollingElement(doc).getScrollTop();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the touch y-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
public final int getRelativeY(Element target) {
return getClientY() - target.getAbsoluteTop() + target.getScrollTop()
+ target.getOwnerDocument().getScrollTop();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the mouse y-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
public int getRelativeY(Element target) {
NativeEvent e = getNativeEvent();
return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop();
}
代码示例来源: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: info.magnolia.ui/magnolia-ui-vaadin-common-widgets
@Override
public void onScroll(ScrollEvent event) {
if (isScrollProcessorLocked) {
return;
}
int newScrollTop = event.getRelativeElement().getScrollTop();
int delta = lastScrollTop - newScrollTop;
escalate(newScrollTop, delta);
lastScrollTop = newScrollTop;
}
};
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Gets the touch y-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
public final int getRelativeY(Element target) {
return getClientY() - target.getAbsoluteTop() + target.getScrollTop()
+ target.getOwnerDocument().getScrollTop();
}
代码示例来源:origin: threerings/playn
/**
* Gets the event's y-position relative to a given element.
*
* @param e native event
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
static float getRelativeY(NativeEvent e, Element target) {
return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop()
+ target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
}
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Gets the touch y-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
public final int getRelativeY(Element target) {
return getClientY() - target.getAbsoluteTop() + target.getScrollTop()
+ target.getOwnerDocument().getScrollTop();
}
代码示例来源:origin: playn/playn
/**
* Gets the event's y-position relative to a given element.
*
* @param e native event
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
static float getRelativeY (NativeEvent e, Element target) {
return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
}
代码示例来源:origin: io.playn/playn-html
/**
* Gets the event's y-position relative to a given element.
*
* @param e native event
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
static float getRelativeY (NativeEvent e, Element target) {
return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
}
代码示例来源: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 y-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
public int getRelativeY(Element target) {
NativeEvent e = getNativeEvent();
return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop();
}
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Gets the mouse y-position relative to a given element.
*
* @param target the element whose coordinate system is to be used
* @return the relative y-position
*/
public int getRelativeY(Element target) {
NativeEvent e = getNativeEvent();
return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop();
}
代码示例来源: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 getRelativeYOfEvent(final DomEvent event) {
final NativeEvent e = event.getNativeEvent();
final Element target = event.getRelativeElement();
return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop();
}
}
代码示例来源:origin: org.geomajas.hammergwt/geomajas-project-hammer-gwt
/**
* Get relative y position on the page.
* @return x position in pixels
*/
public final int getRelativeY() {
NativeEvent e = getNativeEvent();
Element target = getTarget();
return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop();
}
代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client
private int getRelativeY(final ContextMenuEvent event) {
final NativeEvent e = event.getNativeEvent();
final Element target = event.getRelativeElement();
return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop();
}
代码示例来源: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());
}
}
内容来源于网络,如有侵权,请联系作者删除!