List of usage examples for com.google.gwt.event.dom.client MouseEvent getRelativeY
public int getRelativeY(Element target)
From source file:co.fxl.gui.canvas.gwt.GWTCanvas.java
License:Open Source License
private int y(MouseEvent<?> event) { return event.getRelativeY(container.widget.getElement()); }
From source file:com.ait.lienzo.client.core.shape.wires.EventMockUtils.java
License:Open Source License
private static void setUpMouseEvent(final MouseEvent<?> mouseEvent, final double x, final double y) { final int _x = (int) x; final int _y = (int) y; when(mouseEvent.getX()).thenReturn(_x); when(mouseEvent.getClientX()).thenReturn(_x); when(mouseEvent.getRelativeX(any(Element.class))).thenReturn(_x); when(mouseEvent.getRelativeY(any(Element.class))).thenReturn(_y); when(mouseEvent.getY()).thenReturn(_y); when(mouseEvent.getClientY()).thenReturn(_y); when(mouseEvent.isAltKeyDown()).thenReturn(false); when(mouseEvent.isControlKeyDown()).thenReturn(false); when(mouseEvent.isMetaKeyDown()).thenReturn(false); when(mouseEvent.isShiftKeyDown()).thenReturn(false); }
From source file:com.moesol.gwt.maps.client.controls.MapPanZoomControl.java
License:Open Source License
@SuppressWarnings("rawtypes") private void updateVelocity(MouseEvent e) { int eventRelativeX = e.getRelativeX(panButton.getElement()); int eventRelativeY = e.getRelativeY(panButton.getElement()); final int panButtonWidth = panButton.getOffsetWidth(); final int panButtonHeight = panButton.getOffsetHeight(); if (eventRelativeX > 0 && eventRelativeX < panButtonWidth && eventRelativeY > 0 && eventRelativeY < panButtonHeight) { final Style clickHighlightStyle = clickHighlight.getStyle(); clickHighlightStyle.setDisplay(Display.BLOCK); clickHighlightStyle.setLeft(eventRelativeX - (clickHighlight.getClientWidth() / 3), Unit.PX); clickHighlightStyle.setTop(eventRelativeY - (clickHighlight.getClientHeight() / 3), Unit.PX); m_dx = m_presenter.calculateDelta(panButtonWidth, eventRelativeX, m_maxPanPixels); m_dy = -m_presenter.calculateDelta(panButtonHeight, eventRelativeY, m_maxPanPixels); }/*from ww w . j a va 2 s . c om*/ }
From source file:com.moesol.gwt.maps.client.controls.MapPanZoomControlLegacy.java
License:Open Source License
@SuppressWarnings("rawtypes") private void updateVelocity(MouseEvent e) { int eventRelativeX = e.getRelativeX(panButton.getElement()); int eventRelativeY = e.getRelativeY(panButton.getElement()); final int panButtonWidth = panButton.getOffsetWidth(); final int panButtonHeight = panButton.getOffsetHeight(); if (eventRelativeX > 0 && eventRelativeX < panButtonWidth && eventRelativeY > 0 && eventRelativeY < panButtonHeight) { final Style clickHighlightStyle = clickHighlight.getElement().getStyle(); clickHighlightStyle.setDisplay(Display.BLOCK); clickHighlightStyle.setLeft(eventRelativeX - (clickHighlight.getElement().getClientWidth() / 3), Unit.PX);/*w w w. j a va 2 s. com*/ clickHighlightStyle.setTop(eventRelativeY - (clickHighlight.getElement().getClientHeight() / 3), Unit.PX); m_dx = m_presenter.calculateDelta(panButtonWidth, eventRelativeX, m_maxPanPixels); m_dy = -m_presenter.calculateDelta(panButtonHeight, eventRelativeY, m_maxPanPixels); } }
From source file:nl.mpi.tg.eg.experiment.client.view.ColourPickerCanvasView.java
License:Open Source License
private void setColour(MouseEvent event, Canvas targetCanvas, VerticalPanel targetPanel) { setColour(event.getRelativeX(targetCanvas.getElement()), event.getRelativeY(targetCanvas.getElement()), targetCanvas, targetPanel);// ww w . jav a 2s . c o m }
From source file:nl.mpi.tg.eg.experiment.client.view.ColourPickerCanvasView.java
License:Open Source License
private void setHue(MouseEvent event, Canvas targetCanvas) { setHue(event.getRelativeX(targetCanvas.getElement()), event.getRelativeY(targetCanvas.getElement()), targetCanvas);/* w ww. j ava 2 s . c o m*/ }
From source file:org.geomajas.gwt2.plugin.graphicsediting.example.client.annotation.AnnotationContainer.java
License:Open Source License
@Override public Coordinate getScreenCoordinate(MouseEvent<?> event) { Element screenElement = mapPresenter.asWidget().getElement(); return new Coordinate(event.getRelativeX(screenElement), event.getRelativeY(screenElement)); }