Esempio n. 1
0
 public void onMouseMove(MouseMoveEvent event) {
   if (isMouseDown()) {
     setDragging(true);
     updateCSS();
     model.setX(event.getX() + model.getX() - dragStartX);
     model.setY(event.getY() + model.getY() - dragStartY);
     onUpdateInModel();
     int clientX = event.getClientX();
     int clientY = event.getClientY();
     boolean outsideWindow =
         clientX < 0
             || clientY < 0
             || clientX > Window.getClientWidth()
             || clientY > Window.getClientHeight();
     if (outsideWindow) {
       parent.save(model, true);
       setDragging(false);
     }
   }
   event.preventDefault();
 }
Esempio n. 2
0
  NodePresenter(VGraphExplorer parent, NodeProxy model) {
    this.parent = parent;
    this.model = model;
    graph = parent.getGraph();

    view.setTitle(model.getId());
    Style style = view.getElement().getStyle();
    style.setLeft(model.getX(), Unit.PX);
    style.setTop(model.getY(), Unit.PX);

    view.addDomHandler(this, MouseDownEvent.getType());
    view.addDomHandler(this, MouseMoveEvent.getType());
    view.addDomHandler(this, MouseUpEvent.getType());

    parent.add(view);
  }
Esempio n. 3
0
 public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
   return addDomHandler(handler, MouseMoveEvent.getType());
 }