diff --git a/main/src/com/polites/android/GestureImageView.java b/main/src/com/polites/android/GestureImageView.java index 9a70ce4..871fb58 100644 --- a/main/src/com/polites/android/GestureImageView.java +++ b/main/src/com/polites/android/GestureImageView.java @@ -460,6 +460,24 @@ public void setMaxScale(float max) { gestureImageViewTouchListener.setMaxScale(max * startingScale); } } + + /** + * Directly set the image scale size. + * @param newX new x coordiate after zoom update + * @param newY new y coordinate after zoom update + * @param newScale direct scale ratio to set the image to + * @author Bluefire Productions + * + */ + public void setTo(float newX, float newY, float newScale) { + x = newX; + y = newY; + scaleAdjust = newScale; + if (gestureImageViewTouchListener != null) { + gestureImageViewTouchListener.setTo(newX, newY, newScale); + } + redraw(); + } public void setScale(float scale) { scaleAdjust = scale; diff --git a/main/src/com/polites/android/GestureImageViewTouchListener.java b/main/src/com/polites/android/GestureImageViewTouchListener.java index 05945f5..8fdab47 100644 --- a/main/src/com/polites/android/GestureImageViewTouchListener.java +++ b/main/src/com/polites/android/GestureImageViewTouchListener.java @@ -180,6 +180,26 @@ private void startFling() { image.animationStart(flingAnimation); } + + /** + * Directly set the image scale size. + * @param newX new x coordiate after zoom update + * @param newY new y coordiate after zoom update + * @param newScale direct scale ration to set the image to + * @author Bluefire Productions + */ + public void setTo(float newX, float newY, float newScale) { + currentScale = newScale; + lastScale = newScale; + next.x = newX; + next.y = newY; + calculateBoundaries(); + image.setScale(currentScale); + image.setPosition(next.x, next.y); + image.redraw(); + + } + private void startZoom(MotionEvent e) { inZoom = true; zoomAnimation.reset();