Skip to content

Commit

Permalink
fixing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Viven committed May 15, 2017
2 parents b9d5d5a + c6db3dd commit e0e930e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ allprojects {
Then add ImageZoom library
```gradle
dependencies {
compile 'com.github.okaybroda:ImageZoom:1.0.6'
compile 'com.github.okaybroda:ImageZoom:1.0.7'
}
```
## Usage
Expand Down
19 changes: 16 additions & 3 deletions library/src/main/java/com/viven/imagezoom/ImageZoomHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ImageZoomHelper {
private double originalDistance;
private int[] twoPointCenter;
private int[] originalXY;

private int pivotX = 0, pivotY = 0;
private WeakReference<Activity> activityWeakReference;

private boolean isAnimatingDismiss = false;
Expand Down Expand Up @@ -151,6 +151,10 @@ public void run() {
(int) ((pointerCoords2.y + pointerCoords1.y) / 2)
};

//storing pivot point for zooming image from its touch coordinates
pivotX = (int)ev.getRawX() - originalXY[0];
pivotY = (int)ev.getRawY() - originalXY[1];

sendZoomEventToListeners(zoomableView, true);
return true;
}
Expand All @@ -170,6 +174,9 @@ public void run() {
pointerCoords1.y, pointerCoords2.y);
double pctIncrease = (currentDistance - originalDistance) / originalDistance;

zoomableView.setPivotX(pivotX);
zoomableView.setPivotY(pivotY);

zoomableView.setScaleX((float) (1 + pctIncrease));
zoomableView.setScaleY((float) (1 + pctIncrease));

Expand Down Expand Up @@ -272,8 +279,6 @@ public void run() {
finalZoomView.invalidate();
}
});

zoomableView = null;
} else {
dismissDialog();
}
Expand Down Expand Up @@ -305,6 +310,14 @@ private void dismissDialog() {
}

darkView = null;
resetOriginalViewAfterZoom();
}

private void resetOriginalViewAfterZoom() {
if (zoomableView != null) {
zoomableView.invalidate();
zoomableView = null;
}
}

/**
Expand Down

0 comments on commit e0e930e

Please sign in to comment.