Example #1
0
  /**
   * Starts a pan-zoom animation to focus on a set of layoutables.
   *
   * @param layoutablesToInclude the layoutables to zoom in on
   * @param duration_msec how long to animate
   * @param zoomPanAnimationInterpolationPower see startPanZoomAnimation()
   */
  public void startPanZoomAnimationToLayoutables(
      Collection<Layoutable> layoutablesToInclude,
      long duration_msec,
      float zoomPanAnimationInterpolationPower) {
    int left = Integer.MAX_VALUE;
    int right = Integer.MIN_VALUE;
    int top = Integer.MAX_VALUE;
    int bottom = Integer.MIN_VALUE;

    for (Layoutable l : layoutablesToInclude) {
      left = Math.min(left, l.getX());
      right = Math.max(right, l.getX());
      top = Math.min(top, l.getY());
      bottom = Math.max(bottom, l.getY());
    }

    startPanZoomAnimationToArea(
        left, right, top, bottom, duration_msec, zoomPanAnimationInterpolationPower);
  }