/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** * Gets the mouse x-position within the browser window's client area. * * @return the mouse x-position */ public int getClientX() { return getNativeEvent().getClientX(); }
/** * Gets the mouse x-position relative to a given element. * * @param target the element whose coordinate system is to be used * @return the relative x-position */ public int getRelativeX(Element target) { NativeEvent e = getNativeEvent(); return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft(); }
/*************************************** * Returns the horizontal screen position of the pointer at event time (for * pointer-related events). * * @return The horizontal pointer position or {@link Integer#MIN_VALUE} if * not available */ public final int getPointerX() { return rNativeEvent != null ? rNativeEvent.getClientX() : Integer.MIN_VALUE; }
@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 x-position within the browser window's client area. * * @return the mouse x-position */ public int getClientX() { return getNativeEvent().getClientX(); }
@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 x-position relative to a given element. * * @param e native event * @param target the element whose coordinate system is to be used * @return the relative x-position */ static float getRelativeX(NativeEvent e, Element target) { return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale; }
/** * Gets the event's x-position relative to a given element. * * @param e native event * @param target the element whose coordinate system is to be used * @return the relative x-position */ static float getRelativeX (NativeEvent e, Element target) { return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale; }
/** * Gets the event's x-position relative to a given element. * * @param e native event * @param target the element whose coordinate system is to be used * @return the relative x-position */ static float getRelativeX (NativeEvent e, Element target) { return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale; }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX ( final NativeEvent e, final CanvasElement target ) { final float xScaleRatio = ( target.getWidth() * 1f ) / target.getClientWidth(); // Correct // for // canvas // CSS // scaling return Math.round( xScaleRatio * ( ( e.getClientX() - target.getAbsoluteLeft() ) + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft() ) ); }
/** Kindly borrowed from PlayN. **/ protected int getRelativeX (NativeEvent e, CanvasElement target) { float xScaleRatio = target.getWidth() * 1f / target.getClientWidth(); // Correct for canvas CSS scaling return Math.round(xScaleRatio * (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft())); }
/** {@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()); }
/** * Gets the mouse x-position relative to a given element. * * @param target the element whose coordinate system is to be used * @return the relative x-position */ public int getRelativeX(Element target) { NativeEvent e = getNativeEvent(); return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft(); }
public static int getRelativeXOfEvent(final DomEvent event) { final NativeEvent e = event.getNativeEvent(); final Element target = event.getRelativeElement(); return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft(); }
private int getRelativeX(final ContextMenuEvent event) { final NativeEvent e = event.getNativeEvent(); final Element target = event.getRelativeElement(); return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft(); }
/** * Get relative x position on the page. * @return x position in pixels */ public final int getRelativeX() { NativeEvent e = getNativeEvent(); Element target = getTarget(); return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft(); }
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()); }