コード例 #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
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
 private void removeSelectionBox() {
   if (selectionBox.isSelectionBoxVisible()) {
     canvas.remove(selectionBox);
     selectionBox.setSelectionBoxVisible(false);
     VConsole.log("selection box removed from canvas");
     selectionBox.setSelectionBoxRightHandSide(true);
   }
 }
コード例 #3
0
ファイル: VCytographer.java プロジェクト: osmax/vaadin-graph
 private void paintGraph() {
   selectionBox.setSelectionBoxVisible(false);
   fps = 1f / ((System.currentTimeMillis() - paintStartTime) / 1000f);
   paintStartTime = System.currentTimeMillis();
   if (showInfo) {
     if (info != null) {
       canvas.remove(info);
     }
     canvas.add(info = getInfo());
   }
 }