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

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

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

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

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

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

  1. public int getHorizontalScrollPosition() {
  2. return getScrollableElement().getScrollLeft();
  3. }

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

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

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

  1. /**
  2. * Gets the mouse x-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative x-position
  6. */
  7. public int getRelativeX(Element target) {
  8. NativeEvent e = getNativeEvent();
  9. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
  10. target.getOwnerDocument().getScrollLeft();
  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: com.google.gwt/gwt-servlet

  1. void scrollToEnd() {
  2. Element elem = getElement();
  3. targetScrollLeft = elem.getScrollWidth() - elem.getClientWidth();
  4. if (LocaleInfo.getCurrentLocale().isRTL()) {
  5. targetScrollLeft *= -1;
  6. }
  7. if (isAnimationEnabled()) {
  8. // Animate the scrolling.
  9. startScrollLeft = elem.getScrollLeft();
  10. run(250, elem);
  11. } else {
  12. // Scroll instantly.
  13. onComplete();
  14. }
  15. }
  16. }

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

  1. /**
  2. * Gets the event's x-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 x-position
  7. */
  8. static float getRelativeX(NativeEvent e, Element target) {
  9. return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft()
  10. + target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
  11. }

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

  1. /**
  2. * Gets the event's x-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 x-position
  7. */
  8. static float getRelativeX (NativeEvent e, Element target) {
  9. return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
  10. target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
  11. }

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

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

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

  1. /**
  2. * Gets the event's x-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 x-position
  7. */
  8. static float getRelativeX (NativeEvent e, Element target) {
  9. return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
  10. target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
  11. }

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

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

代码示例来源: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 x-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative x-position
  6. */
  7. public int getRelativeX(Element target) {
  8. NativeEvent e = getNativeEvent();
  9. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
  10. target.getOwnerDocument().getScrollLeft();
  11. }

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

  1. /**
  2. * Gets the mouse x-position relative to a given element.
  3. *
  4. * @param target the element whose coordinate system is to be used
  5. * @return the relative x-position
  6. */
  7. public int getRelativeX(Element target) {
  8. NativeEvent e = getNativeEvent();
  9. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
  10. target.getOwnerDocument().getScrollLeft();
  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 getRelativeXOfEvent(final DomEvent event) {
  2. final NativeEvent e = event.getNativeEvent();
  3. final Element target = event.getRelativeElement();
  4. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft();
  5. }

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

  1. private int getRelativeX(final ContextMenuEvent event) {
  2. final NativeEvent e = event.getNativeEvent();
  3. final Element target = event.getRelativeElement();
  4. return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft();
  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. }

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

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

相关文章

Element类方法