Пример #1
0
 /**
  * Scales the view about the center of the canvas.
  *
  * @param scale the amount to scale
  */
 private void scaleViewAboutPoint(double scale) {
   Rectangle canvasBounds = graph.getCanvas().getBounds();
   graph
       .getCanvas()
       .getCamera()
       .scaleViewAboutPoint(scale, canvasBounds.getCenterX(), canvasBounds.getCenterY());
 }
Пример #2
0
 /**
  * Controls which direction to pan the canvas.
  *
  * @param dir integer representing the direction to pan
  */
 private void pan(int dir) {
   int amount = 15;
   if (dir == LEFT) {
     graph.getCanvas().getCamera().translateView(-amount, 0);
   } else if (dir == RIGHT) {
     graph.getCanvas().getCamera().translateView(amount, 0);
   } else if (dir == UP) {
     graph.getCanvas().getCamera().translateView(0, -amount);
   } else if (dir == DOWN) {
     graph.getCanvas().getCamera().translateView(0, amount);
   }
 }