private void handleEvent (NativeEvent e) { if (e.getType().equals("mousedown")) { if (!e.getEventTarget().equals(canvas) || pressedButtons.contains(getButton(e.getButton()))) { float mouseX = getRelativeX(e, canvas); float mouseY = getRelativeY(e, canvas); this.justTouched = true; this.touched[0] = true; this.pressedButtons.add(getButton(e.getButton())); this.deltaX[0] = 0; this.deltaY[0] = 0; if (processor != null) processor.touchDown(touchX[0], touchY[0], 0, getButton(e.getButton())); if (!pressedButtons.contains(getButton(e.getButton()))) return; this.pressedButtons.remove(getButton(e.getButton())); this.touched[0] = pressedButtons.size > 0; if (isCursorCatched()) { if (processor != null) processor.touchUp(touchX[0], touchY[0], 0, getButton(e.getButton()));
private void handleEvent (NativeEvent e) { if (e.getType().equals("mousedown")) { if (!e.getEventTarget().equals(canvas) || pressedButtons.contains(getButton(e.getButton()))) { float mouseX = getRelativeX(e, canvas); float mouseY = getRelativeY(e, canvas); this.justTouched = true; this.touched[0] = true; this.pressedButtons.add(getButton(e.getButton())); this.deltaX[0] = 0; this.deltaY[0] = 0; if (processor != null) processor.touchDown(touchX[0], touchY[0], 0, getButton(e.getButton())); if (!pressedButtons.contains(getButton(e.getButton()))) return; this.pressedButtons.remove(getButton(e.getButton())); this.touched[0] = pressedButtons.size > 0; if (isCursorCatched()) { if (processor != null) processor.touchUp(touchX[0], touchY[0], 0, getButton(e.getButton()));
/** * Gets the button value. Compare it to * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_LEFT}, * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_RIGHT}, * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_MIDDLE} * <p> * Note: this is unreliable for events not caused by the depression * or release of a mouse button. * * @return the button value */ public int getNativeButton() { return getNativeEvent().getButton(); }
protected static Mouse.ButtonEvent.Id getMouseButton (NativeEvent evt) { switch (evt.getButton()) { case (NativeEvent.BUTTON_LEFT): return Mouse.ButtonEvent.Id.LEFT; case (NativeEvent.BUTTON_MIDDLE): return Mouse.ButtonEvent.Id.MIDDLE; case (NativeEvent.BUTTON_RIGHT): return Mouse.ButtonEvent.Id.RIGHT; default: return null; } }
protected static Mouse.ButtonEvent.Id getMouseButton (NativeEvent evt) { switch (evt.getButton()) { case (NativeEvent.BUTTON_LEFT): return Mouse.ButtonEvent.Id.LEFT; case (NativeEvent.BUTTON_MIDDLE): return Mouse.ButtonEvent.Id.MIDDLE; case (NativeEvent.BUTTON_RIGHT): return Mouse.ButtonEvent.Id.RIGHT; default: return null; } }
/*************************************** * Returns the pointer button that caused the pointer event. * * @return The number of the pointer button pressed, starting at 1 */ public final int getPointerButton() { int nButton = 0; if (rNativeEvent != null) { int nNativeButtons = rNativeEvent.getButton(); if ((nNativeButtons & NativeEvent.BUTTON_LEFT) != 0) { nButton = 1; } else if ((nNativeButtons & NativeEvent.BUTTON_RIGHT) != 0) { nButton = 2; } else if ((nNativeButtons & NativeEvent.BUTTON_MIDDLE) != 0) { nButton = 3; } } return nButton; }
/** * Gets the button value. Compare it to * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_LEFT}, * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_RIGHT}, * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_MIDDLE} * <p> * Note: this is unreliable for events not caused by the depression * or release of a mouse button. * * @return the button value */ public int getNativeButton() { return getNativeEvent().getButton(); }
/** * Gets the button value. Compare it to * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_LEFT}, * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_RIGHT}, * {@link com.google.gwt.dom.client.NativeEvent#BUTTON_MIDDLE} * <p> * Note: this is unreliable for events not caused by the depression * or release of a mouse button. * * @return the button value */ public int getNativeButton() { return getNativeEvent().getButton(); }
/** * Is the mouse down event a valid mouse drag event, i.e. left mouse button * is pressed without any modifier keys * * @param event * The mouse event * @return Is the mouse event a valid drag event */ private boolean isMouseDragEvent(NativeEvent event) { boolean hasModifierKey = event.getAltKey() || event.getCtrlKey() || event.getMetaKey() || event.getShiftKey(); return !(hasModifierKey || event.getButton() > NativeEvent.BUTTON_LEFT); }
/** * Is the mouse down event a valid mouse drag event, i.e. left mouse button * is pressed without any modifier keys * * @param event * The mouse event * @return Is the mouse event a valid drag event */ private boolean isMouseDragEvent(NativeEvent event) { boolean hasModifierKey = event.getAltKey() || event.getCtrlKey() || event.getMetaKey() || event.getShiftKey(); return !(hasModifierKey || event.getButton() > NativeEvent.BUTTON_LEFT); }
@Override public void call(Void aVoid, int index) { NativeEvent event = D3.getEvent(); if (D3.eventDefaultPrevented()) { return; } if (!isMarqueeSelected() && event.getButton() == NativeEvent.BUTTON_LEFT && event.getEventTarget().equals(m_topologyView.getSVGElement())) { onBackgroundClick(); } event.preventDefault(); event.stopPropagation(); } });
@Override public void call(Void aVoid, int index) { NativeEvent event = D3.getEvent(); if (D3.eventDefaultPrevented()) { return; } if (!isMarqueeSelected() && event.getButton() == NativeEvent.BUTTON_LEFT && event.getEventTarget().equals(m_topologyView.getSVGElement())) { onBackgroundClick(); } event.preventDefault(); event.stopPropagation(); } });
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()); }
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()); }
@Override public void onMouseDown(MouseDownEvent event) { if (handler.preventDefault) { event.preventDefault(); } if (handler.stopPropagation) { event.stopPropagation(); } boolean right = event.getNativeEvent().getButton() == NativeEvent.BUTTON_RIGHT; if (!CancelEventTimer.cancelMouseEvent() && !handler.onClickStart(event.getX(), event.getY(), PointerEventType.MOUSE, right)) { handler.onClickStart(event.getX(), event.getY(), PointerEventType.MOUSE); } } }, MouseDownEvent.getType());
public EventClone(MouseEvent<?> mouseEvent) { NativeEvent evt = mouseEvent.getNativeEvent(); type = evt.getType(); screenX = evt.getScreenX(); screenY = evt.getScreenY(); clientX = evt.getClientX(); clientY = evt.getClientY(); ctrlKey = evt.getCtrlKey(); altKey = evt.getAltKey(); shiftKey = evt.getShiftKey(); metaKey = evt.getMetaKey(); button = evt.getButton(); relatedEventTarget = evt.getRelatedEventTarget(); }
public EventClone(MouseEvent<?> mouseEvent) { NativeEvent evt = mouseEvent.getNativeEvent(); type = evt.getType(); screenX = evt.getScreenX(); screenY = evt.getScreenY(); clientX = evt.getClientX(); clientY = evt.getClientY(); ctrlKey = evt.getCtrlKey(); altKey = evt.getAltKey(); shiftKey = evt.getShiftKey(); metaKey = evt.getMetaKey(); button = evt.getButton(); relatedEventTarget = evt.getRelatedEventTarget(); }
public void addSelectionHandler() { tree.addSelectionHandler(event -> onItemSelection(event.getSelectedItem(), false)); tree.addMouseDownHandler(event -> { if (event.getNativeEvent().getButton() == NativeEvent.BUTTON_RIGHT) { onItemSelection(findSelectedItem(event.getClientX(), event.getClientY()), true); } }); tree.addKeyDownHandler(event -> isControlKeyDown = event.isControlKeyDown()); tree.addKeyUpHandler(event -> isControlKeyDown = event.isControlKeyDown()); }
final boolean shiftKey = n.getShiftKey(); final boolean metaKey = n.getMetaKey(); final int button = n.getButton();