コード例 #1
0
  private void mouseDown(GwtEvent<? extends EventHandler> event) {
    int[] coord = getCoordinates(event);
    previousX = coord[0];
    previousY = coord[1];
    isMouseDown = true;

    if (canvas instanceof InteractorCanvas && draggableNode == null)
      draggableNode = ((InteractorCanvas) canvas).getDraggableNode(new Point(previousX, previousY));

    diagramPane.hideTooltip();
  }
コード例 #2
0
  private void centreObject(GraphObject obj) {
    // Centre selected object
    // PathwayCanvas c = diagramPane.getCanvas();

    double scale = canvas.getScale();

    Point objPos = obj.getPosition();
    double objX = objPos.getX();
    double objY = objPos.getY();

    double x = (objX * -1.0 * scale) + (canvas.getCoordinateSpaceWidth() / 2);
    double y = (objY * -1.0 * scale) + (canvas.getCoordinateSpaceHeight() / 2);

    diagramPane.reset();
    diagramPane.scale(scale);
    diagramPane.translate(x, y, true);
    diagramPane.hideTooltip();
  }