Permalink
Browse files

fix zoom gesture bug in photo brwoser

  • Loading branch information...
1 parent a885740 commit e2a326ea8bd81bfcbee36aeff60dda26ab978bfc @lihongxun945 committed Mar 28, 2016
Showing with 4 additions and 5 deletions.
  1. +1 −0 docs/changelog.html
  2. +3 −5 js/photo-browser.js
View
@@ -30,6 +30,7 @@ <h2 class="page-title">Changelog</h2>
<li>Swiper update to V3.3.1</li>
<li>Fix toast position</li>
<li>Fix bug: the keyboard will open when open calendar on some android device.</li>
+ <li>Fix bug: zoom gesture bug in photo browser</li>
<li>Add Version Number in JS file</li>
</ul>
View
@@ -347,7 +347,7 @@
};
pb.onSlideGestureChange = function (e) {
if (!gestureImg || gestureImg.length === 0) return;
- scale = e.scale * currentScale;
+ scale = (e.scale || e.originalEvent.scale) * currentScale;
if (scale > pb.params.maxZoom) {
scale = pb.params.maxZoom - 1 + Math.pow((scale - pb.params.maxZoom + 1), 0.5);
}
@@ -390,8 +390,7 @@
if (imageIsTouched) return;
if ($.device.os === 'android') e.preventDefault();
imageIsTouched = true;
- imageTouchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
- imageTouchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
+ imageTouchesStart = $.getTouchPosition(e);
};
pb.onSlideTouchMove = function (e) {
if (!gestureImg || gestureImg.length === 0) return;
@@ -416,8 +415,7 @@
imageMinY = Math.min((pb.swiper.height / 2 - scaledHeight / 2), 0);
imageMaxY = -imageMinY;
- imageTouchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
- imageTouchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
+ imageTouchesCurrent = $.getTouchPosition(e);
if (!imageIsMoved && !isScaling) {
if (

0 comments on commit e2a326e

Please sign in to comment.