mjau-mjau wrote:
In latest Files app, the popup was much improved and although it's built upon the core of photoswipe, we don't use photoswipe options any longer. Besides, I am struggling to see the benefit of your implementation. Do you have an example link where this is used? I was testing this feature before, and couldn't find any good reasons to zoom beyond 1 (original) or offer different steps. Seems unproductive.
PhotoSwipe.js Documentation
getDoubleTapZoom: function(isMouseClick, item) {
// isMouseClick - true if mouse, false if double-tap
// item - slide object that is zoomed, usually current
// item.initialZoomLevel - initial scale ratio of image
// e.g. if viewport is 700px and image is 1400px,
// initialZoomLevel will be 0.5
if(isMouseClick) {
// is mouse click on image or zoom icon
// zoom to original
return 1;
// e.g. for 1400px image:
// 0.5 - zooms to 700px
// 2 - zooms to 2800px
} else {
// is double-tap
// zoom to original if initial zoom is less than 0.7x,
// otherwise to 1.5x, to make sure that double-tap gesture always zooms image
return item.initialZoomLevel < 0.7 ? 1 : 1.5;
}
}
Modify it because if the picture resolution is very large, double-click zooming will appear as the original image, which is very unfriendly, I have to limit the size of the image after double-click zooming in.
I've handled it, I've found that the configuration is in the files .js, I've modified it,
files .js Delete code:
// getDoubleTapZoom: function() {
// return e.toggle_play(!1),
// 1
// },
modify the code
getDoubleTapZoom: function(e, t) {
return e || t.initialZoomLevel < .7 ? 1 : 1.33
},
//be revised as
getDoubleTapZoom: function(e, t) {
return e ? 1 : t.initialZoomLevel < .2 ? .4 : t.initialZoomLevel < .3 ? .5 : t.initialZoomLevel < .5 ? .8 : 1.33
},
if viewport is 700px and image is 1400px,
initialZoomLevel will be 0.5.
<div class="pswp__zoom-wrap" style="transform: translate3d(-633px, 10px, 0px) scale(0.4);"><img class="pswp__img" src="/home/ee217a9c4562cd216bd395b16ce8a252.jpg" style="opacity: 1; width: 2560px; height: 1440px; display: block;"></div>
If it’s a 2560*1920 picture, after the double-tap gesture scale(0.4);
The problem is solved!
But there will be a problem, the video double-click is also zoomed.
There is another question: the mouse click on the picture is changed to zoom instead of the page. Is there a setting option for this?