/** Kindly borrowed from PlayN. **/ protected int getRelativeY (NativeEvent e, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY (NativeEvent e, CanvasElement target) { float yScaleRatio = target.getHeight() * 1f / target.getClientHeight(); // Correct for canvas CSS scaling return Math.round(yScaleRatio * (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop())); }
/** * Get the window's scroll top. * * @return the window's scroll top */ public static int getScrollTop() { return Document.get().getScrollTop(); }
@Override public int getAbsoluteTop(Element elem) { Document doc = elem.getOwnerDocument(); return getBoundingClientRectTop(elem) + doc.getScrollTop(); }
/** * 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(); }
/** * 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(); }
/** * Get the window's scroll top. * * @return the window's scroll top */ public static int getScrollTop() { return Document.get().getScrollTop(); }
/** * Get the window's scroll top. * * @return the window's scroll top */ public static int getScrollTop() { return Document.get().getScrollTop(); }
@Override public int getAbsoluteTop(Element elem) { Document doc = elem.getOwnerDocument(); return getBoundingClientRectTop(elem) + doc.getScrollTop(); }
/** * 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(); }
/** * 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; } }
/** * 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(); }
/** * 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; }
/** Kindly borrowed from PlayN. **/ protected int getRelativeY ( final NativeEvent e, final CanvasElement target ) { final float yScaleRatio = ( target.getHeight() * 1f ) / target.getClientHeight(); // Correct // for // canvas // CSS // scaling return Math.round( yScaleRatio * ( ( e.getClientY() - target.getAbsoluteTop() ) + target.getScrollTop() + target.getOwnerDocument().getScrollTop() ) ); }
/** * 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(); }
/** * 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(); }
/** * Gets the mouse y-position relative to the canvas element. * @param clientY The event's clienty value. * @return the relative y-position */ private double getRelativeY(final double clientY) { return clientY - getCanvasElement().getAbsoluteTop() + getCanvasElement().getScrollTop() + getCanvasElement().getOwnerDocument().getScrollTop(); }
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(); } }
/** * 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(); }
/** * The mouse position relative to the top edge of the document. * */ public final int pageY() { if (getTouches() != null && getTouches().length() > 0) { return getTouches().get(0).getPageY(); } else { return getClientY() + GQuery.document.getScrollTop(); } }