@Override protected void continueDragging(MouseMoveEvent event) { if (this.dragMode >= 0 && this.resizable) { this.updateCursor(this.dragMode); int dx = event.getClientX() - this.dragX; int dy = event.getClientY() - this.dragY; this.dragX = event.getClientX(); this.dragY = event.getClientY(); dragResizeWidget(this, dx, dy); } else { // this updates the cursor when dragging is NOT activated if (!this.minimized) { int dm = calcDragMode(event.getClientX(),event.getClientY()); this.updateCursor(dm); } super.continueDragging(event); } }
public ConsoleDisplay() { super(new AbsolutePanel(), CLASS_NAME); getElement().setId("consoleDisplayWrapper"); // Create display panel where screen is actually loaded display = new AbsolutePanel(); display.addStyleName("portrait"); display.getElement().setId("consoleDisplay"); // Add display to the wrapper ((AbsolutePanel)getWidget()).add(display, 0, 0); // Add move handlers which are only used on this display component if(BrowserUtils.isMobile) { this.addDomHandler(this, TouchMoveEvent.getType()); } else { this.addDomHandler(this, MouseMoveEvent.getType()); this.addDomHandler(this, MouseOutEvent.getType()); } }
@Override public void onMouseMove(MouseMoveEvent event) { event.preventDefault(); event.stopPropagation(); lastMoveEvent = new PressMoveEvent(event); ConsoleUnitEventManager.getInstance().getEventBus().fireEvent(lastMoveEvent); }
@Override public void onMouseMove(MouseMoveEvent event) { // There's a weird bug in Chrome on Windows 10 64bit that causes a mouse move event to fire on mouse down so this tries to workaround it // https://bugs.chromium.org/p/chromium/issues/detail?id=721341 if (startEvent != null && (startEvent.getClientX() != event.getClientX() || startEvent.getClientY() != event.getClientY())) { event.preventDefault(); event.stopPropagation(); propagateEvent(new PressMoveEvent(event)); } }
@UiHandler("self") void handleMouseMove(MouseMoveEvent e) { Element top = self.getElement(); Element target; target = e.getNativeEvent().getEventTarget().cast(); while (!top.equals(target)) { if (DigestDomImpl.KIND_DIGEST.equals(target.getAttribute(BuilderHelper.KIND_ATTRIBUTE)) ) { handleTouch(byId.get(target.getAttribute(DigestDomImpl.DIGEST_ID_ATTRIBUTE)) ); return; } target = target.getParentElement(); if (target == null) { break; } } handleTouch(null); }
@Override boolean dispatch(MouseMoveEvent event, Element target) { //firing MouseCome and MouseLeave events basing on MouseMove if (target != prevTarget) { if (prevTarget != null) { //create and dispatch new MouseLeaveEvent for previous context mouseComeLeaveHandlers.dispatch( new MouseLeaveEvent(prevEvent, prevTarget, target), prevTarget); } if (target != null) { //create and dispatch new MouseComeLeaveEvent for current context mouseComeLeaveHandlers.dispatch(new MouseComeEvent(event, target, prevTarget), target); } prevTarget = target; } prevEvent = event; super.dispatch(event, target); return true; }
public void onMouseMove(MouseMoveEvent event) { //Store the last time the mouse was moved lastUserActivityMillisec = System.currentTimeMillis(); //If the user is in the forced away mode then we make him go back to the old mode if( isInForcedAway ) { isInForcedAway = false; userStatusQueue.setCurrentUserStatus( userStatusQueue.getPreviousUserStatus() ); } else { //In case we can do automatic status enforcement if( userStatusQueue.canDoUserStatusInforcement() ) { //The actual user status that comes from the server with the room updates is know if( actualChatUserStatus != null ) { //The actual visible user status is not the same as set in the local user interface if( actualChatUserStatus != userStatusQueue.getCurrentUserStatus() ) { //Force the server status update, forcing the update in any case userStatusQueue.forceUserStatusToTheServer( userStatusQueue.getCurrentUserStatus() ); } } } } }
public void onMouseMove(MouseMoveEvent e) { e.preventDefault(); mouseCursorX=e.getX(); mouseCursorY=e.getY(); if (mouseDragging) { mouseDragged(e); return; } mouseSelect(e); }
@Override public void onMouseMove(WebPlotView pv, ScreenPt spt, MouseMoveEvent ev) { if (_mouseDown) { dragTimer.cancel(); dragTimer.setupCall(spt,ev.getScreenX(), ev.getScreenY()); _lastX= ev.getScreenX(); _lastY= ev.getScreenY(); dragTimer.schedule(10); // drag(spt,false); // _mouseInfo.setEnableAllPersistent(true); } }
@Override public void onMouseMove(MouseMoveEvent event) { if (previousX == event.getX() && previousY == event.getY()) return; previousX = event.getX(); previousY = event.getY(); showUI(); }
private double calculateDockSize(MouseMoveEvent event, DocksBar docksBar) { UberfireDockPosition position = docksBar.getPosition(); if (position == UberfireDockPosition.WEST) { return docksBar.getExpandedBarSize() + (event.getClientX() - getAbsoluteLeft()); } if (position == UberfireDockPosition.EAST) { return docksBar.getExpandedBarSize() + (getAbsoluteLeft() - event.getClientX()); } if (position == UberfireDockPosition.SOUTH) { return docksBar.getExpandedBarSize() + (getAbsoluteTop() - event.getClientY()); } return docksBar.getExpandedBarSize(); }
public VerticalSplit() { super(); addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (mouseDown) { double leftWidthPct = ((event.getClientX() - getContentAbsoluteLeft() - offset) / getContentWidth()) * 100; double rightWidthPct = 100 - leftWidthPct; setLeftAreaWidth(leftWidthPct); setRightAreaWidth(rightWidthPct); getElement().getStyle().setLeft(leftArea.getOffsetWidth() - 3, Style.Unit.PX); onResize.execute(); event.preventDefault(); } } }, MouseMoveEvent.getType()); }
public HorizontalSplit() { super(); addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (mouseDown) { double topHeightPct = ((event.getClientY() - getContentAbsoluteTop() - offset) / getContentHeight()) * 100; double bottomHeightPct = 100 - topHeightPct; setTopAreaHeight(topHeightPct); setBottomHeight(bottomHeightPct); getElement().getStyle().setTop(topArea.getOffsetHeight() - 6, Style.Unit.PX); onResize.execute(); event.preventDefault(); } } }, MouseMoveEvent.getType()); }
protected void setupDelegatingMouseMoveHandler() { final Style style = widgetContainer.getElement().getStyle(); widgetContainer.addDomHandler(new MouseMoveHandler() { @Override public void onMouseMove(final MouseMoveEvent event) { //The DOM Element changes the Cursor, so set to the state determined by the MouseEvent Handlers on GridLayer style.setCursor(gridLayer.getGridWidgetHandlersState().getCursor()); gridLayer.onNodeMouseMove(new NodeMouseMoveEvent(event) { @Override public int getX() { //Adjust the x-coordinate (relative to the DOM Element) to be relative to the GridCanvas. return super.getX() + widgetContainer.getElement().getOffsetLeft(); } @Override public int getY() { //Adjust the y-coordinate (relative to the DOM Element) to be relative to the GridCanvas. return super.getY() + widgetContainer.getElement().getOffsetTop(); } }); } }, MouseMoveEvent.getType()); }
@Test public void testMouseMoveEvent_RightEdge() { final MouseDownEvent md0 = mock(MouseDownEvent.class); when(md0.getRelativeX(any(Element.class))).thenReturn(0); when(md0.getRelativeY(any(Element.class))).thenReturn(0); final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0); final MouseMoveEvent mm1 = mock(MouseMoveEvent.class); when(mm1.getRelativeX(any(Element.class))).thenReturn(-200); when(mm1.getRelativeY(any(Element.class))).thenReturn(0); final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1); final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class); mediator.handleEvent(nmd0); mediator.handleEvent(nmm1); verify(viewport, times(1)).setTransform(transformArgumentCaptor.capture()); final Transform result = transformArgumentCaptor.getValue(); assertNotNull(result); assertEquals(0.0, result.getTranslateX(), 0.0); assertEquals(0.0, result.getTranslateY(), 0.0); }
@Override public void onMouseMove( MouseMoveEvent event ) { if( !fResizing ) return; updateSize( event.getNativeEvent().getEventTarget(), event.getScreenX() - startX, event.getScreenY() - startY ); event.stopPropagation(); event.preventDefault(); }
@Override public void onMouseMove( MouseMoveEvent event ) { if( m_callback == null ) return; event.preventDefault(); int x = event.getRelativeX( m_canvas.getElement() ); m_callback.onMouseMove( m_cookie, x ); }
protected void addMoveHandler() { if (msTouchSupported) { moveRegisteration = addDomHandler(pointerMoveHandler, PointerMoveEvent.getType()); touchCancelRegisteration = addDomHandler(pointerCancelHandler, PointerCancelEvent.getType()); } else if (touchSupported) { moveRegisteration = addDomHandler(touchMoveHandler, TouchMoveEvent.getType()); touchCancelRegisteration = addDomHandler(touchCancelHandler, TouchCancelEvent.getType()); } else { moveRegisteration = addDomHandler(mouseMoveHandler, MouseMoveEvent.getType()); } }
public void onMouseMove(MouseMoveEvent event) { if (service.getEditingState() == GeometryEditState.INSERTING) { Coordinate location = getLocation(event, RenderSpace.WORLD); if (snappingEnabled) { Coordinate result = snappingService.snap(location); if (snappingService.hasSnapped()) { service.setTentativeMoveLocation(result); } else { service.setTentativeMoveLocation(location); service.getIndexStateService().snappingEndAll(); } } else { service.setTentativeMoveLocation(location); service.getIndexStateService().snappingEndAll(); } } }
public void onMouseMove(MouseMoveEvent event) { if (dragging) { int y = event.getY(); if (y < minY) { y = minY; } if (y > maxY) { y = maxY; } zoomHandle.getElement().getStyle().setTop(y, Unit.PX); handleY += (y - currentY); zoomToY(handleY); currentY = y; event.stopPropagation(); } }
@Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); // Only add a mouse move handler if someone is interested in, as // otherwise // they would generate a large amount of server side traffic. if (stateChangeEvent.hasPropertyChanged("listenMouseMove") && getState().listenMouseMove) getWidget().addMouseMoveHandler(new MouseMoveHandler() { @Override public void onMouseMove(MouseMoveEvent event) { if (getState().listenMouseMove) { MouseEventDetails med = MouseEventDetailsBuilder .buildMouseEventDetails(event.getNativeEvent(), getWidget().getElement()); rpc.mouseMoved(med); } } }); }
/** * Update event caches to keep track of the latest event of each instance. * @param the event to cache */ private void updateEventCaches(Event<?> event){ if(event == null){ return; } if(event instanceof DoubleClickEvent){ doubleClickEvent = new org.gz.gwt.mousemanager.client.event.DoubleClickEvent((DoubleClickEvent)event, target); } if(event instanceof ClickEvent){ clickEvent = new org.gz.gwt.mousemanager.client.event.ClickEvent((ClickEvent)event, target); } if(event instanceof MouseUpEvent){ mouseUpEvent = new org.gz.gwt.mousemanager.client.event.MouseUpEvent((MouseUpEvent)event, target); } if(event instanceof MouseDownEvent){ mouseDownEvent = new org.gz.gwt.mousemanager.client.event.MouseDownEvent((MouseDownEvent)event, target); } if(event instanceof MouseMoveEvent){ mouseMoveEvent = new org.gz.gwt.mousemanager.client.event.MouseMoveEvent((MouseMoveEvent)event, target); } if(event instanceof MouseOverEvent){ mouseOverEvent = new org.gz.gwt.mousemanager.client.event.MouseOverEvent((MouseOverEvent)event, target); } if(event instanceof MouseOutEvent){ mouseOutEvent = new org.gz.gwt.mousemanager.client.event.MouseOutEvent((MouseOutEvent)event, target); } if(event instanceof MouseWheelEvent){ mouseWheelEvent = new org.gz.gwt.mousemanager.client.event.MouseWheelEvent((MouseWheelEvent)event, target); } if(event instanceof ContextMenuEvent){ contextMenuEvent = new org.gz.gwt.mousemanager.client.event.ContextMenuEvent(); } }
/** * @param note * the note to render */ public NoteView(Note note) { this.note = note; setStyleName("note"); note.setObserver(this); final Element elem = getElement(); elem.getStyle().setProperty("position", "absolute"); titleElement = elem.appendChild(Document.get().createDivElement()); titleElement.setClassName("note-title"); content.setStyleName("note-content"); content.addValueChangeHandler(this); setWidget(content); render(); addDomHandler(this, MouseDownEvent.getType()); addDomHandler(this, MouseMoveEvent.getType()); addDomHandler(this, MouseUpEvent.getType()); }
public void onMouseMove(MouseMoveEvent event) { if (dragging) { setPixelPosition(event.getX() + getAbsoluteLeft() - dragOffsetX, event.getY() + getAbsoluteTop() - dragOffsetY); event.preventDefault(); } }
@Override public void onMouseMove(MouseMoveEvent event) { if (event.isControlKeyDown()) { Element newSource = event.getRelativeElement(); if (source != newSource && source != null) { Hex from = Hex.fromSVGId(source.getId()); Hex to = Hex.fromSVGId(newSource.getId()); drawLine(from, to); if (path.isEmpty()) { path.add(source); } path.add(newSource); } setCurrent(newSource); } }
@Override public void onMouseMove(MouseMoveEvent e) { if (mouseDown) { panning = true; float x = mouse.x; float y = mouse.y; OMSVGPoint start = toUsertSpace(x, y); OMSVGPoint pos = toUsertSpace(e.getClientX(), e.getClientY()); OMSVGRect viewBox = svg.getViewBox().getBaseVal(); viewBox.setX(offset.x + (start.getX() - pos.getX())); viewBox.setY(offset.y + (start.getY() - pos.getY())); } else { panning = false; updateMousePosition(e); } }
private void registerHandlers() { if(BrowserUtils.isMobile) { registerHandler(this.addDomHandler(this, TouchStartEvent.getType())); registerHandler(this.addDomHandler(this, TouchEndEvent.getType())); registerHandler(this.addDomHandler(this, TouchMoveEvent.getType())); } else { registerHandler(this.addDomHandler(this, MouseDownEvent.getType())); registerHandler(this.addDomHandler(this, MouseUpEvent.getType())); registerHandler(this.addDomHandler(this, MouseOutEvent.getType())); registerHandler(this.addDomHandler(this, MouseMoveEvent.getType())); } }
/** * Creates new mouse come event basing on the source mouse move event. */ public MouseComeLeaveEvent(MouseMoveEvent srcEvent, Element contextElement, Element anotherElement) { this.srcEvent = srcEvent; this.contextElement = contextElement; this.anotherElement = anotherElement; }
public void onMouseMove(MouseMoveEvent event) { ChartState chartInfo = getChartState(event); Chart chart = chartInfo.chart; XYPlot plot = chart.getPlot(); int x = getLocalX(event); int y = getLocalY(event); CompoundUIAction uiAction = chartInfo.getCompoundUIAction(); if (uiAction.isSelecting(plot)) { chart.setAnimating(true); plot.setHighlight(uiAction.getStartX(), x); } else if (uiAction.getSource() != null && uiAction .isDragging(uiAction.getSource())) { int dragThd = uiAction.isDragStarted(plot) ? 1 : (uiAction.getSource() instanceof Overlay ? 5 : 10); boolean dragThresholdReached = Math.abs(uiAction.getStartX() - x) > dragThd; if (dragThresholdReached) { if (uiAction.getSource() instanceof Overlay) { if (!uiAction.isDragStarted(plot)) { plot.fireEvent(new ChartDragStartEvent(plot, x)); uiAction.setDragStarted(true); uiAction.setDragStartX(uiAction.getStartX()); } ((Overlay) uiAction.getSource()).fire(new ChartDragEvent(plot, x)); chart.setHover(x,y); } else { chart.setAnimating(true); chart.scrollPixels(uiAction.getStartX() - x); } uiAction.setStartX(x); event.stopPropagation(); event.preventDefault(); } } else if ((null != plot) && (null != plot.getBounds()) && (plot.getBounds().inside(x, y))) { if (chart.setHover(x, y)) { chart.setCursor(Cursor.CLICKABLE); } else { chart.setCursor(Cursor.DRAGGABLE); } } chartInfo.setHandled(true); }
public void onMouseMove(MouseMoveEvent e){ // GWT.log("Move"); e.preventDefault(); doMouseMove(e.getX()); }
private void continueDragging(MouseMoveEvent event) { if (dragging) { int absX = event.getX() + contentContainer.getAbsoluteLeft(); int absY = event.getY() + contentContainer.getAbsoluteTop(); // if the mouse is off the screen to the left, right, or top, don't // move the dialog box. This would let users lose dialog boxes, which // would be bad for modal popups. if (absX < clientLeft || absX >= windowWidth || absY < clientTop) { return; } setPopupPosition(absX - dragStartX, absY - dragStartY); } }
@Override public void onMouseMove(WebPlotView pv, ScreenPt spt, MouseMoveEvent ev) { if (_mouseDown) { drag(pv, spt); } else { changePointer(pv,spt); } }
private void setCursorShape(MouseMoveEvent ev) { if (_expandW==null) return; int x= getAbsoluteX(ev); int y= getAbsoluteY(ev); PopupRegion r= findRegion(x,y); if (r==PopupRegion.SE_CORNER) { GwtUtil.setStyle(popup, "cursor", "se-resize"); } else if (r==PopupRegion.SW_CORNER) { GwtUtil.setStyle(popup, "cursor", "sw-resize"); } else { GwtUtil.setStyle(popup, "cursor", "auto"); } }
public UIHider(int uiHideDelay, Widget textLayer) { this.uiHideDelay = uiHideDelay; textLayer.addDomHandler(this, MouseMoveEvent.getType()); textLayer.addDomHandler(this, KeyDownEvent.getType()); textLayer.addDomHandler(this, ScrollEvent.getType()); textLayer.addDomHandler(this, TouchStartEvent.getType()); }
public PanListener(Widget widget) { this.widget = widget; widget.addDomHandler(this, MouseDownEvent.getType()); widget.addDomHandler(this, MouseUpEvent.getType()); widget.addDomHandler(this, MouseMoveEvent.getType()); widget.addDomHandler(this, TouchStartEvent.getType()); widget.addDomHandler(this, TouchEndEvent.getType()); widget.addDomHandler(this, TouchMoveEvent.getType()); }
@Override public void onMouseMove(MouseMoveEvent event) { if (isMouseDown) { pan(event.getX() - x, event.getY() - y); x = event.getX(); y = event.getY(); } }
@Override public void onMouseMove(MouseMoveEvent p_event) { AnBoardPosition position = convertPixPositionToHexPosition( new AnPair( p_event.getX(), p_event.getY() ) ); if( (position.getX() != m_hexagonHightlightPosition.getX()) || (position.getY() != m_hexagonHightlightPosition.getY()) ) { m_hexagonHightlightPosition = position; m_layerSelect.moveHightLightHexagon( m_hexagonHightlightPosition ); } }
@Override public void onMouseMove(MouseMoveEvent p_event) { p_event.preventDefault(); onMove(Element.as(p_event.getNativeEvent().getEventTarget()), p_event.getClientX(), p_event.getClientY()); }
@Test public void testEnablePointerEvents() { final MouseMoveEvent mouseMoveEvent = mock(MouseMoveEvent.class); final AbsolutePanel domElementContainer = mock(AbsolutePanel.class); final GridLienzoScrollUI scrollUI = mock(GridLienzoScrollUI.class); doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer(); doReturn(scrollUI).when(gridLienzoScrollHandler).gridLienzoScrollUI(); doNothing().when(scrollUI).disablePointerEvents(any()); gridLienzoScrollHandler.enablePointerEvents().onMouseMove(mouseMoveEvent); verify(scrollUI).enablePointerEvents(domElementContainer); }