aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2014-04-26 08:26:20 +0200
committerHakim El Hattab <hakim.elhattab@gmail.com>2014-04-26 08:26:20 +0200
commit3adaed2a1ee1bb3306cb30aa86b90819d1c03af6 (patch)
treea9c99a6179f1d115352825be990ff946d518f8ee
parenta49a78c454ab88120af37b0cc44df75cd0c31601 (diff)
downloadperl-software-in-gnu-guix-3adaed2a1ee1bb3306cb30aa86b90819d1c03af6.tar
perl-software-in-gnu-guix-3adaed2a1ee1bb3306cb30aa86b90819d1c03af6.tar.gz
allow tall slides to spread over pages in pdf export
-rw-r--r--js/reveal.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/js/reveal.js b/js/reveal.js
index 3ca9d6f..00c3aa0 100644
--- a/js/reveal.js
+++ b/js/reveal.js
@@ -430,22 +430,30 @@ var Reveal = (function(){
// Vertical stacks are not centred since their section
// children will be
if( slide.classList.contains( 'stack' ) === false ) {
+ // Center the slide inside of the page, giving the slide some margin
var left = ( pageWidth - slideWidth ) / 2,
top = ( pageHeight - slideHeight ) / 2;
- if( config.center || slide.classList.contains( 'center' ) ) {
- top = Math.max( ( pageHeight - getAbsoluteHeight( slide ) ) / 2, 0 );
+ var contentHeight = getAbsoluteHeight( slide );
+ var numberOfPages = Math.ceil( contentHeight / slideHeight );
+
+ // Top align when we're taller than a single page
+ if( numberOfPages > 1 ) {
+ top = 0;
+ }
+ // Center the slide vertically
+ else if( config.center || slide.classList.contains( 'center' ) ) {
+ top = Math.max( ( pageHeight - contentHeight ) / 2, 0 );
}
+ // Position the slide inside of the page
slide.style.left = left + 'px';
slide.style.top = top + 'px';
slide.style.width = slideWidth + 'px';
- slide.style.height = slideHeight + 'px';
-
- if( slide.scrollHeight > slideHeight ) {
- slide.style.overflow = 'hidden';
- }
+ slide.style.height = ( slideHeight * numberOfPages ) + 'px';
+ // TODO Backgrounds need to be multiplied when the slide
+ // stretches over multiple pages
var background = slide.querySelector( '.slide-background' );
if( background ) {
background.style.width = pageWidth + 'px';