add min/max scale settings (#310)

This commit is contained in:
Hakim El Hattab 2013-01-30 23:59:37 -05:00
parent 1ca8306e2a
commit 9660cdbd26
2 changed files with 14 additions and 5 deletions

View File

@ -19,11 +19,16 @@ var Reveal = (function(){
// The "normal" size of the presentation, aspect ratio will be preserved // The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions // when the presentation is scaled to fit different resolutions
width: 1024, width: 960,
height: 768, height: 700,
// Factor of the display size that should remain empty around the content
margin: 0.1, margin: 0.1,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
maxScale: 1.4,
// Display controls in the bottom right corner // Display controls in the bottom right corner
controls: true, controls: true,
@ -588,6 +593,10 @@ var Reveal = (function(){
// Determine scale of content to fit within available space // Determine scale of content to fit within available space
var scale = Math.min( availableWidth / slideWidth, availableHeight / slideHeight ); var scale = Math.min( availableWidth / slideWidth, availableHeight / slideHeight );
// Respect max/min scale settings
scale = Math.max( scale, config.minScale );
scale = Math.min( scale, config.maxScale );
// Prefer applying scale via zoom since Chrome blurs scaled content // Prefer applying scale via zoom since Chrome blurs scaled content
// with nested transforms // with nested transforms
if( typeof dom.slides.style.zoom !== 'undefined' && !navigator.userAgent.match( /(iphone|ipod|android)/gi ) ) { if( typeof dom.slides.style.zoom !== 'undefined' && !navigator.userAgent.match( /(iphone|ipod|android)/gi ) ) {
@ -1123,7 +1132,7 @@ var Reveal = (function(){
var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' ); var slideAutoSlide = slides[index].getAttribute( 'data-autoslide' );
if( slideAutoSlide ) { if( slideAutoSlide ) {
autoSlide = parseInt( slideAutoSlide, 10 ); autoSlide = parseInt( slideAutoSlide, 10 );
} }
else { else {
autoSlide = config.autoSlide; autoSlide = config.autoSlide;
} }

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long