Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Directly Set Zoom Settings #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions main/src/com/polites/android/GestureImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 20 additions & 0 deletions main/src/com/polites/android/GestureImageViewTouchListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down