forked from blallo/talk-hm-0x15
allow tall slides to spread over pages in pdf export
This commit is contained in:
parent
a49a78c454
commit
3adaed2a1e
1 changed files with 15 additions and 7 deletions
22
js/reveal.js
22
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';
|
||||
|
|
Loading…
Reference in a new issue