|
@@ -1014,12 +1014,8 @@ var Reveal = (function(){
|
|
|
dom.slides.style.width = slideWidth + 'px';
|
|
|
dom.slides.style.height = slideHeight + 'px';
|
|
|
|
|
|
-
|
|
|
- toArray( dom.slides.querySelectorAll( 'section > .remaining-height' ) ).forEach( function( element ) {
|
|
|
-
|
|
|
- element.style.height = getRemainingHeight( element, ( slideHeight - ( slidePadding * 2 ) ) ) + 'px';
|
|
|
-
|
|
|
- } );
|
|
|
+
|
|
|
+ layoutSlideContents( config.width, config.height, slidePadding );
|
|
|
|
|
|
|
|
|
scale = Math.min( availableWidth / slideWidth, availableHeight / slideHeight );
|
|
@@ -1071,6 +1067,38 @@ var Reveal = (function(){
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * Applies layout logic to the contents of all slides in
|
|
|
+ * the presentation.
|
|
|
+ */
|
|
|
+ function layoutSlideContents( width, height, padding ) {
|
|
|
+
|
|
|
+
|
|
|
+ toArray( dom.slides.querySelectorAll( 'section > .remaining-height' ) ).forEach( function( element ) {
|
|
|
+
|
|
|
+
|
|
|
+ var remainingHeight = getRemainingHeight( element, ( height - ( padding * 2 ) ) );
|
|
|
+
|
|
|
+
|
|
|
+ if( /(img|video)/gi.test( element.nodeName ) ) {
|
|
|
+ var nw = element.naturalWidth,
|
|
|
+ nh = element.naturalHeight;
|
|
|
+
|
|
|
+ var es = Math.min( width / nw, remainingHeight / nh );
|
|
|
+
|
|
|
+ element.style.width = ( nw * es ) + 'px';
|
|
|
+ element.style.height = ( nh * es ) + 'px';
|
|
|
+
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ element.style.width = width + 'px';
|
|
|
+ element.style.height = remainingHeight + 'px';
|
|
|
+ }
|
|
|
+
|
|
|
+ } );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* Stores the vertical index of a stack so that the same
|
|
|
* vertical slide can be selected when navigating to and
|