com.google.gwt.dom.client.Element.getScrollTop()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(315)

本文整理了Java中com.google.gwt.dom.client.Element.getScrollTop()方法的一些代码示例,展示了Element.getScrollTop()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getScrollTop()方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getScrollTop

Element.getScrollTop介绍

[英]The number of pixels that an element's content is scrolled from the top.
[中]元素内容从顶部滚动的像素数。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. public int getVerticalScrollPosition() {
  2. return getScrollableElement().getScrollTop();
  3. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. public int getScrollTop(Document doc) {
  2. return ensureDocumentScrollingElement(doc).getScrollTop();
  3. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Gets the touch y-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative y-position
  6. */
  7. public final int getRelativeY(Element target) {
  8. return getClientY() - target.getAbsoluteTop() + target.getScrollTop()
  9. + target.getOwnerDocument().getScrollTop();
  10. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. /**
  2. * Gets the mouse y-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative y-position
  6. */
  7. public int getRelativeY(Element target) {
  8. NativeEvent e = getNativeEvent();
  9. return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
  10. target.getOwnerDocument().getScrollTop();
  11. }

代码示例来源:origin: com.google.gwt/gwt-servlet

  1. public void onScroll(ScrollEvent event) {
  2. Widget source = getSource(event);
  3. Element elem = source.getElement();
  4. getListener().onScroll(getSource(event), elem.getScrollLeft(),
  5. elem.getScrollTop());
  6. }
  7. }

代码示例来源:origin: info.magnolia.ui/magnolia-ui-vaadin-common-widgets

  1. @Override
  2. public void onScroll(ScrollEvent event) {
  3. if (isScrollProcessorLocked) {
  4. return;
  5. }
  6. int newScrollTop = event.getRelativeElement().getScrollTop();
  7. int delta = lastScrollTop - newScrollTop;
  8. escalate(newScrollTop, delta);
  9. lastScrollTop = newScrollTop;
  10. }
  11. };

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. /**
  2. * Gets the touch y-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative y-position
  6. */
  7. public final int getRelativeY(Element target) {
  8. return getClientY() - target.getAbsoluteTop() + target.getScrollTop()
  9. + target.getOwnerDocument().getScrollTop();
  10. }

代码示例来源:origin: threerings/playn

  1. /**
  2. * Gets the event's y-position relative to a given element.
  3. *
  4. * @param e native event
  5. * @param target the element whose coordinate system is to be used
  6. * @return the relative y-position
  7. */
  8. static float getRelativeY(NativeEvent e, Element target) {
  9. return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop()
  10. + target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
  11. }
  12. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Gets the touch y-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative y-position
  6. */
  7. public final int getRelativeY(Element target) {
  8. return getClientY() - target.getAbsoluteTop() + target.getScrollTop()
  9. + target.getOwnerDocument().getScrollTop();
  10. }

代码示例来源:origin: playn/playn

  1. /**
  2. * Gets the event's y-position relative to a given element.
  3. *
  4. * @param e native event
  5. * @param target the element whose coordinate system is to be used
  6. * @return the relative y-position
  7. */
  8. static float getRelativeY (NativeEvent e, Element target) {
  9. return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
  10. target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
  11. }

代码示例来源:origin: io.playn/playn-html

  1. /**
  2. * Gets the event's y-position relative to a given element.
  3. *
  4. * @param e native event
  5. * @param target the element whose coordinate system is to be used
  6. * @return the relative y-position
  7. */
  8. static float getRelativeY (NativeEvent e, Element target) {
  9. return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
  10. target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
  11. }

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets

  1. @Test
  2. public void testOnScroll() {
  3. reset(element);
  4. when(element.getScrollTop()).thenReturn(100);
  5. when(element.getScrollLeft()).thenReturn(200);
  6. tested.onScroll(scrollEvent);
  7. verify(paletteStyle, times(1)).setTop(100, Style.Unit.PX);
  8. verify(paletteStyle, times(1)).setLeft(200, Style.Unit.PX);
  9. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. /**
  2. * Gets the mouse y-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative y-position
  6. */
  7. public int getRelativeY(Element target) {
  8. NativeEvent e = getNativeEvent();
  9. return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
  10. target.getOwnerDocument().getScrollTop();
  11. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Gets the mouse y-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative y-position
  6. */
  7. public int getRelativeY(Element target) {
  8. NativeEvent e = getNativeEvent();
  9. return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
  10. target.getOwnerDocument().getScrollTop();
  11. }

代码示例来源:origin: org.kie.workbench.stunner/kie-wb-common-stunner-widgets

  1. @EventHandler("sessionContainer")
  2. protected void onScroll(@ForEvent("scroll") ScrollEvent e) {
  3. // on the editor scroll recalculate palette position to be fixed on the screen
  4. palettePanel.getElement().getStyle().setTop(paletteInitialTop + e.getRelativeElement().getScrollTop(),
  5. Style.Unit.PX);
  6. palettePanel.getElement().getStyle().setLeft(paletteInitialLeft + e.getRelativeElement().getScrollLeft(),
  7. Style.Unit.PX);
  8. e.preventDefault();
  9. }

代码示例来源:origin: net.wetheinter/gwt-user

  1. public void onScroll(ScrollEvent event) {
  2. Widget source = getSource(event);
  3. Element elem = source.getElement();
  4. getListener().onScroll(getSource(event), elem.getScrollLeft(),
  5. elem.getScrollTop());
  6. }
  7. }

代码示例来源:origin: org.uberfire/uberfire-wires-core-grids

  1. public static int getRelativeYOfEvent(final DomEvent event) {
  2. final NativeEvent e = event.getNativeEvent();
  3. final Element target = event.getRelativeElement();
  4. return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop();
  5. }
  6. }

代码示例来源:origin: org.geomajas.hammergwt/geomajas-project-hammer-gwt

  1. /**
  2. * Get relative y position on the page.
  3. * @return x position in pixels
  4. */
  5. public final int getRelativeY() {
  6. NativeEvent e = getNativeEvent();
  7. Element target = getTarget();
  8. return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
  9. target.getOwnerDocument().getScrollTop();
  10. }

代码示例来源:origin: org.drools/drools-wb-guided-dtable-editor-client

  1. private int getRelativeY(final ContextMenuEvent event) {
  2. final NativeEvent e = event.getNativeEvent();
  3. final Element target = event.getRelativeElement();
  4. return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop();
  5. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. public void onScroll(ScrollEvent event) {
  2. Widget source = getSource(event);
  3. Element elem = source.getElement();
  4. getListener().onScroll(getSource(event), elem.getScrollLeft(),
  5. elem.getScrollTop());
  6. }
  7. }

相关文章

Element类方法