/** 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())); }
/** * Gets the mouse y-position within the browser window's client area. * * @return the mouse y-position */ public int getClientY() { return getNativeEvent().getClientY(); }
/** * 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(); }
@Override public void onPreviewNativeEvent(NativePreviewEvent event) { if (Event.ONCLICK == event.getTypeInt()) { Point clickPoint = new Point( event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY()); /* * In mobile browsers, when the user touches on the screen, drag * his finger across and take his finger off, the browser fires a * click event at the position where the touch start happen. This * click event is called "ghost click". This click is not intended by * the user and thus needs to be busted. * Also, while the panel is scrolling, if the user taps on the screen * we want to stop the scrolling and bust the click event that's fired * because the user probably didn't mean to click on something. */ if (isClickScrollTriggeringTouch(clickPoint) || isClickTouchPositionDuringMomentum(clickPoint)) { event.cancel(); event.getNativeEvent().stopPropagation(); event.getNativeEvent().preventDefault(); } } } });
/** * Gets the mouse y-position within the browser window's client area. * * @return the mouse y-position */ public int getClientY() { return getNativeEvent().getClientY(); }
/** * Gets the mouse y-position within the browser window's client area. * * @return the mouse y-position */ public int getClientY() { return getNativeEvent().getClientY(); }
@Override public void onDrag(Element elem) { int clientX = D3.getEvent().getClientX() - m_offsetX; int clientY = D3.getEvent().getClientY() - m_offsetY; setMarquee( Math.min(m_x1, clientX), Math.min(m_y1, clientY), Math.abs(m_x1 - clientX), Math.abs(m_y1 - clientY) ); selectVertices(); D3.getEvent().stopPropagation(); D3.getEvent().preventDefault(); }
@Override public void onDrag(Element elem) { int clientX = D3.getEvent().getClientX() - m_offsetX; int clientY = D3.getEvent().getClientY() - m_offsetY; setMarquee( Math.min(m_x1, clientX), Math.min(m_y1, clientY), Math.abs(m_x1 - clientX), Math.abs(m_y1 - clientY) ); selectVertices(); D3.getEvent().stopPropagation(); D3.getEvent().preventDefault(); }
/** * 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 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 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(); }
/** {@inheritDoc} */ @Override public void onContextMenu(ContextMenuEvent event) { // construct for each editor tab own context menu, // that will have store information about selected virtual file and pin state at first step // in future maybe we should create another mechanism to associate context menu with initial // dto's editorTabContextMenu .newContextMenu(this, relatedEditorPart, relatedEditorPartStack) .show(event.getNativeEvent().getClientX(), event.getNativeEvent().getClientY()); }
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(); }
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(); }
protected SVGPoint getEventPoint(NativeEvent event) { SVGElement svg = getTopologyView().getSVGElement().cast(); SVGPoint p = svg.createSVGPoint(); p.setX(event.getClientX()); p.setY(event.getClientY()); return p; }
protected SVGPoint getEventPoint(NativeEvent event) { SVGElement svg = getTopologyView().getSVGElement().cast(); SVGPoint p = svg.createSVGPoint(); p.setX(event.getClientX()); p.setY(event.getClientY()); return p; }
protected void dragInit(DragObject dragObject, NativeEvent ne) { isDragInProgress = true; isDropIn = false; initializeDragOptionsCache(dragObject); calculateEventRestrictions(dragObject); if (dragInitEventEnabled){ GWT.log("DragInitEvent"); eventBus.fireEventFromSource(new DragInitEvent(dragObject, ne), dragObject.getSourceWidget()); } dragObject.init(ne.getClientX(), ne.getClientY()); }
private static NativeEvent createMouseDownEvent(NativeEvent e) { return Document.get().createMouseDownEvent(0, e.getScreenX(), e.getScreenY(), e.getClientX(), e.getClientY(), e.getCtrlKey(), e.getAltKey(), e.getShiftKey(), e.getMetaKey(), e.getButton()); }