diff options
author | setnes <kristopher@setnes.net> | 2015-05-25 19:58:48 +0300 |
---|---|---|
committer | setnes <kristopher@setnes.net> | 2015-06-06 21:55:53 +0300 |
commit | 8c0bcfb7e647d595e6b6fbd5da25520dadd30bcf (patch) | |
tree | c70b433ee1eba9defe2a64f1c21a286b631e93ec /js/galleryfileaction.js | |
parent | e82c9bff96f8eb0a800348b6eb899715f2ca8adc (diff) |
Tweaks for fewer preview sizes, device rotation, and slideshow zooming.
Request preview sizes in multiples of 100.
Request preview sizes based on longest edge of window.
This allows the image to still be large enough on device rotation.
Scale images in Bigshot that are larger than window.
Set minZoom using getZoomToFitValue if the image is larger than the
window. This allows us to downscale, but prevents the user from
zooming out (making the image smaller) more than necessary.
Moved the scaling logic to _resetZoom function.
Stop treating SVG as small images.
This fixes zoom issues for SVG images in the slideshow.
Diffstat (limited to 'js/galleryfileaction.js')
-rw-r--r-- | js/galleryfileaction.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/js/galleryfileaction.js b/js/galleryfileaction.js index e8205f2e..79122a87 100644 --- a/js/galleryfileaction.js +++ b/js/galleryfileaction.js @@ -62,6 +62,14 @@ var galleryFileAction = { var width = Math.floor($(window).width() * window.devicePixelRatio); var height = Math.floor($(window).height() * window.devicePixelRatio); + /* Find value of longest edge. */ + var longEdge = Math.max( width, height ); + + /* Find the next larger image size. */ + if ( longEdge % 100 !== 0 ){ + longEdge = ( longEdge + 100 ) - ( longEdge % 100 ); + } + for (var i = 0; i < files.length; i++) { var file = files[i]; // We only add images to the slideshow if we think we'll be able @@ -69,8 +77,8 @@ var galleryFileAction = { if (galleryFileAction.mediaTypes[file.mimetype]) { /* jshint camelcase: false */ var params = { - width: width, - height: height, + width: longEdge, + height: longEdge, c: file.etag, requesttoken: oc_requesttoken }; @@ -120,4 +128,4 @@ $(document).ready(function () { // Media files are retrieved through the Files context $.getJSON(url, {}, galleryFileAction.register); }); -});
\ No newline at end of file +}); |