Пример #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;
 }