diff options
author | Hakim El Hattab <hakim.elhattab@gmail.com> | 2014-11-08 09:06:17 +0100 |
---|---|---|
committer | Hakim El Hattab <hakim.elhattab@gmail.com> | 2014-11-08 09:06:17 +0100 |
commit | 8c76f85e34564e8fa2d38f2c2424ed4edc6d6c74 (patch) | |
tree | 7243782db59b6efe8da673e230d046a189eacc4d /js/reveal.js | |
parent | 54e44ef4e20029da95bd34e26fd640f4b7ed5809 (diff) | |
download | fosdem-2018-presentation-8c76f85e34564e8fa2d38f2c2424ed4edc6d6c74.tar fosdem-2018-presentation-8c76f85e34564e8fa2d38f2c2424ed4edc6d6c74.tar.gz |
reorder scale condition; if calculated scale is exactly 1 don't apply any scale styles
Diffstat (limited to 'js/reveal.js')
-rw-r--r-- | js/reveal.js | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/js/reveal.js b/js/reveal.js index a6bd81a..ef3471c 100644 --- a/js/reveal.js +++ b/js/reveal.js @@ -1469,16 +1469,23 @@ dom.slides.style.width = size.width + 'px'; dom.slides.style.height = size.height + 'px'; - // No point in calculating scale if the only possible - // result is 1 - if( scale !== -1 || config.minScale !== 1 || config.maxScale !== 1 ) { - // Determine scale of content to fit within available space - scale = Math.min( size.presentationWidth / size.width, size.presentationHeight / size.height ); - - // Respect max/min scale settings - scale = Math.max( scale, config.minScale ); - scale = Math.min( scale, config.maxScale ); - + // Determine scale of content to fit within available space + scale = Math.min( size.presentationWidth / size.width, size.presentationHeight / size.height ); + + // Respect max/min scale settings + scale = Math.max( scale, config.minScale ); + scale = Math.min( scale, config.maxScale ); + + // Don't apply any scaling styles if scale is 1 + if( scale === 1 ) { + dom.slides.style.zoom = ''; + dom.slides.style.left = ''; + dom.slides.style.top = ''; + dom.slides.style.bottom = ''; + dom.slides.style.right = ''; + transformElement( dom.slides, '' ); + } + else { // Prefer zooming in desktop Chrome so that content remains crisp if( !isMobileDevice && /chrome/i.test( navigator.userAgent ) && typeof dom.slides.style.zoom !== 'undefined' ) { dom.slides.style.zoom = scale; |