コード例 #1
0
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
  @Override
  public void onMouseDown(final MouseDownEvent event) {
    VConsole.log("onMouseDown");
    extractSelection();
    removeSelectionBox();

    if (currentKeyModifiers.contains(KeyCodes.KEY_CTRL)) {
      selectionBox.setSelectionBoxStartX(event.getX());
      selectionBox.setSelectionBoxStartY(event.getY());
      selectionBox.setSelectionBoxVisible(true);
      VConsole.log(
          "onMouseDown - selection started:"
              + selectionBox.getSelectionBoxStartX()
              + ","
              + selectionBox.getSelectionBoxStartY());
    } else if (event.getSource() instanceof VNode) {
      onMove = false;
    } else if (event.getSource() instanceof DrawingArea) {
      onMove = true;
      startX = event.getX();
      startY = event.getY();
      VConsole.log("onMouseDown - moving");
    } else {
      VConsole.error("onMouseDown - UNKNOWN STATE");
    }
  }
コード例 #2
0
 public void onMouseDown(MouseDownEvent event) {
   setMouseDown(true);
   updateCSS();
   DOM.setCapture(view.getElement());
   dragStartX = event.getX();
   dragStartY = event.getY();
   event.preventDefault();
 }
コード例 #3
0
  public void onMouseDown(@Nonnull final MouseDownEvent event) {
    dragging = true;

    // capturing the mouse to the dragged widget.
    DOM.setCapture(container.getElement());
    startY = event.getY();
    ClientLog.log("DOWN", null);
    event.stopPropagation();
    event.preventDefault();
    originalStyle = widget.getElement().getAttribute("style");
  }
コード例 #4
0
ファイル: CanvasWidget.java プロジェクト: eohlson/gwt-board
  private Postit addNewPostit(MouseDownEvent event) {
    System.out.println("Create");

    Postit postit = new Postit();
    postit.x = event.getX();
    postit.y = event.getY();
    postit.width = 50;
    postit.height = 20;

    postits.add(postit);

    return postit;
  }