Ejemplo n.º 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");
    }
  }
Ejemplo n.º 2
0
 private void extractSelection() {
   final int x1 = selectionBox.getSelectionBoxStartX();
   final int y1 = selectionBox.getSelectionBoxStartY();
   if (selectionBox.isSelectionBoxVisible()) {
     final int x2 = x1 + selectionBox.getWidth();
     final int y2 = y1 + selectionBox.getHeight();
     VConsole.log("selectNodesAndEdgesInTheBox: " + x1 + "," + y1 + " " + x2 + "," + y2);
     selectNodesAndEdgesInTheBox(x1, y1, x2, y2);
   }
 }