コード例 #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 down by the standard amount */
 public void panDown() {
   drawOffset.y += getHeight() / (DEFAULT_PAN_DIVISOR * zoom);
 }
コード例 #3
0
 /** pan up by the standard amount */
 public void panUp() {
   drawOffset.y -= getHeight() / (DEFAULT_PAN_DIVISOR * zoom);
 }
コード例 #4
0
 /** set the aggregate y-axis pan */
 public void setPanY(int y) {
   drawOffset.y = y;
 }