示例#1
0
  /** applies the next step in the pan-zoom animation, if any */
  private void stepPanZoomAnimation() {
    if (zoomPanAnimationEndTime == 0) return;

    long now = System.currentTimeMillis();
    if (now >= zoomPanAnimationEndTime) {
      zoom = zoomTo;
      drawOffset.x = panTo.x;
      drawOffset.y = panTo.y;
      stopPanZoomAnimation();
    } else {
      long duration = zoomPanAnimationEndTime - zoomPanAnimationStartTime;
      long diff = zoomPanAnimationEndTime - now;
      float alpha = (float) Math.pow(diff / (float) duration, zoomPanAnimationInterpolationPower);
      float beta = 1.0f - alpha;
      zoom = (zoomFrom * alpha) + (zoomTo * beta);
      drawOffset.x = (int) ((panFrom.x * alpha) + (panTo.x * beta));
      drawOffset.y = (int) ((panFrom.y * alpha) + (panTo.y * beta));
    }
  }
示例#2
0
 /** pan left by the standard amount */
 public void panLeft() {
   drawOffset.x -= getWidth() / (DEFAULT_PAN_DIVISOR * zoom);
 }
示例#3
0
 /** pan right by the standard amount */
 public void panRight() {
   drawOffset.x += getWidth() / (DEFAULT_PAN_DIVISOR * zoom);
 }
示例#4
0
 /** set the aggregate x-axis pan */
 public void setPanX(int x) {
   drawOffset.x = x;
 }