com.google.gwt.event.dom.client.MouseMoveEvent Java Examples

The following examples show how to use com.google.gwt.event.dom.client.MouseMoveEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 6 votes vote down vote up
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());
    }
}
 
Example #2
Source File: PanListener.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
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());
}
 
Example #3
Source File: PanListener.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
	if (isMouseDown) {
		pan(event.getX() - x, event.getY() - y);
		x = event.getX();
		y = event.getY();
	}
}
 
Example #4
Source File: UIHider.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
	if (previousX == event.getX() && previousY == event.getY())
		return;
	previousX = event.getX();
	previousY = event.getY();
	showUI();
}
 
Example #5
Source File: UIHider.java    From djvu-html5 with GNU General Public License v2.0 5 votes vote down vote up
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());
}
 
Example #6
Source File: DateCell.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
@Override
protected void onAttach() {
    super.onAttach();

    handlers.add(addHandler(this, MouseDownEvent.getType()));
    handlers.add(addHandler(this, MouseUpEvent.getType()));
    handlers.add(addHandler(this, MouseMoveEvent.getType()));
    handlers.add(addDomHandler(this, ContextMenuEvent.getType()));
    handlers.add(addKeyDownHandler(this));
}
 
Example #7
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void onMouseMove(MouseMoveEvent event) {
	int mouseX = event.getRelativeX(topCanvas.getElement());
	int mouseY = event.getRelativeY(topCanvas.getElement());
	mousePoint.setLeft(mouseX);
	mousePoint.setTop(mouseY);

	int offsetMouseX = event.getClientX();
	int offsetMouseY = event.getClientY();
	mouseOffsetPoint.setLeft(offsetMouseX);
	mouseOffsetPoint.setTop(offsetMouseY);
}
 
Example #8
Source File: CirSim.java    From circuitjs1 with GNU General Public License v2.0 5 votes vote down vote up
public void onMouseMove(MouseMoveEvent e) {
	e.preventDefault();
	mouseCursorX=e.getX();
	mouseCursorY=e.getY();
	if (mouseDragging) {
		mouseDragged(e);
		return;
	}
	mouseSelect(e);
}
 
Example #9
Source File: HandlerPanel.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
  return addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example #10
Source File: P.java    From unitime with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return addHandler(handler, MouseMoveEvent.getType());
}
 
Example #11
Source File: DateCell.java    From calendar-component with Apache License 2.0 4 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
    handleEventRange(event);
}
 
Example #12
Source File: CirSim.java    From circuitjs1 with GNU General Public License v2.0 4 votes vote down vote up
public void mouseDragged(MouseMoveEvent e) {
  	// ignore right mouse button with no modifiers (needed on PC)
  	if (e.getNativeButton()==NativeEvent.BUTTON_RIGHT) {
  		if (!(e.isMetaKeyDown() ||
  				e.isShiftKeyDown() ||
  				e.isControlKeyDown() ||
  				e.isAltKeyDown()))
  			return;
  	}
  	
  	if (tempMouseMode==MODE_DRAG_SPLITTER) {
  		dragSplitter(e.getX(), e.getY());
  		return;
  	}
  	int gx = inverseTransformX(e.getX());
  	int gy = inverseTransformY(e.getY());
  	if (!circuitArea.contains(e.getX(), e.getY()))
  	    return;
  	boolean changed = false;
  	if (dragElm != null)
  	    dragElm.drag(gx, gy);
  	boolean success = true;
  	switch (tempMouseMode) {
  	case MODE_DRAG_ALL:
  		dragAll(e.getX(), e.getY());
  		break;
  	case MODE_DRAG_ROW:
  		dragRow(snapGrid(gx), snapGrid(gy));
  		changed = true;
  		break;
  	case MODE_DRAG_COLUMN:
dragColumn(snapGrid(gx), snapGrid(gy));
  		changed = true;
  		break;
  	case MODE_DRAG_POST:
  		if (mouseElm != null) {
  		    dragPost(snapGrid(gx), snapGrid(gy));
  		    changed = true;
  		}
  		break;
  	case MODE_SELECT:
  		if (mouseElm == null)
  		    selectArea(gx, gy);
  		else {
  		    // wait short delay before dragging.  This is to fix problem where switches were accidentally getting
  		    // dragged when tapped on mobile devices
  		    if (System.currentTimeMillis()-mouseDownTime < 150)
  			return;
  		
  		    tempMouseMode = MODE_DRAG_SELECTED;
  		    changed = success = dragSelected(gx, gy);
  		}
  		break;
  	case MODE_DRAG_SELECTED:
  		changed = success = dragSelected(gx, gy);
  		break;

  	}
  	dragging = true;
  	if (success) {
  	    dragScreenX = e.getX();
  	    dragScreenY = e.getY();
  //	    console("setting dragGridx in mousedragged");
  	    dragGridX = inverseTransformX(dragScreenX);
  	    dragGridY = inverseTransformY(dragScreenY);
  	    if (!(tempMouseMode == MODE_DRAG_SELECTED && onlyGraphicsElmsSelected())) {
  		dragGridX = snapGrid(dragGridX);
  		dragGridY = snapGrid(dragGridY);
  	    }
 	}
  	if (changed)
  	    writeRecoveryToStorage();
  	repaint();
  }
 
Example #13
Source File: AbstractInput.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public com.google.gwt.event.shared.HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return this.addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example #14
Source File: ListItem.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return this.addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example #15
Source File: Anchor.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
	return this.addDomHandler(handler, MouseMoveEvent.getType());
}
 
Example #16
Source File: GanttWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
    GanttWidget.this.onTouchOrMouseMove(event.getNativeEvent());
    event.preventDefault();
}
 
Example #17
Source File: GanttWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
/**
 * Reset listeners.
 */
public void resetListeners() {
    Event.sinkEvents(container, Event.ONSCROLL | Event.ONCONTEXTMENU);

    if (contextMenuHandlerRegistration == null) {
        contextMenuHandlerRegistration = addDomHandler(contextMenuHandler, ContextMenuEvent.getType());
    }

    if (scrollHandlerRegistration == null) {
        scrollHandlerRegistration = addHandler(scrollHandler, ScrollEvent.getType());
    }
    if (isMsTouchSupported()) {
        // IE10 pointer events (ms-prefixed events)
        if (pointerDownHandlerRegistration == null) {
            pointerDownHandlerRegistration = addDomHandler(msPointerDownHandler, PointerDownEvent.getType());
        }
        if (pointerUpHandlerRegistration == null) {
            pointerUpHandlerRegistration = addDomHandler(msPointerUpHandler, PointerUpEvent.getType());
        }
        if (pointerMoveHandlerRegistration == null) {
            pointerMoveHandlerRegistration = addDomHandler(msPointerMoveHandler, PointerMoveEvent.getType());
        }
        if (pointerCancelHandlerRegistration == null) {
            pointerCancelHandlerRegistration = addHandler(msPointerCancelHandler, PointerCancelEvent.getType());
        }
    } else if (touchSupported) {
        // touch events replaces mouse events
        if (touchStartHandlerRegistration == null) {
            touchStartHandlerRegistration = addDomHandler(touchStartHandler, TouchStartEvent.getType());
        }
        if (touchEndHandlerRegistration == null) {
            touchEndHandlerRegistration = addDomHandler(touchEndHandler, TouchEndEvent.getType());
        }
        if (touchMoveHandlerRegistration == null) {
            touchMoveHandlerRegistration = addDomHandler(touchMoveHandler, TouchMoveEvent.getType());
        }
        if (touchCancelHandlerRegistration == null) {
            touchCancelHandlerRegistration = addHandler(touchCancelHandler, TouchCancelEvent.getType());
        }

    } else {
        if (mouseDblClickHandlerRegistration == null) {
            mouseDblClickHandlerRegistration = addDomHandler(doubleClickHandler, DoubleClickEvent.getType());
        }
        if (mouseDownHandlerRegistration == null) {
            mouseDownHandlerRegistration = addDomHandler(mouseDownHandler, MouseDownEvent.getType());
        }
        if (mouseUpHandlerRegistration == null) {
            mouseUpHandlerRegistration = addDomHandler(mouseUpHandler, MouseUpEvent.getType());
        }
        if (isMovableSteps() || isResizableSteps()) {
            if (mouseMoveHandlerRegistration == null) {
                mouseMoveHandlerRegistration = addDomHandler(mouseMoveHandler, MouseMoveEvent.getType());
            }
        } else if (mouseMoveHandlerRegistration != null) {
            mouseMoveHandlerRegistration.removeHandler();
            mouseMoveHandlerRegistration = null;
        }
    }
}
 
Example #18
Source File: SvgArrowWidget.java    From gantt with Apache License 2.0 4 votes vote down vote up
@Override
public void onMouseMove(MouseMoveEvent event) {
    GWT.log("SvgArrowWidget.onMouseMove(MouseMoveEvent)");

    handleMove(event.getNativeEvent());
}