Example #1
0
  @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");
    }
  }
Example #2
0
 public void onMouseDown(MouseDownEvent event) {
   setMouseDown(true);
   updateCSS();
   DOM.setCapture(view.getElement());
   dragStartX = event.getX();
   dragStartY = event.getY();
   event.preventDefault();
 }
Example #3
0
  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;
  }