Skip to content

Commit

Permalink
Merge branch 'dev' into jh/print-optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
hermansje authored Dec 20, 2020
2 parents e57ff23 + f576b98 commit acafabf
Show file tree
Hide file tree
Showing 18 changed files with 13,532 additions and 3,154 deletions.
22 changes: 11 additions & 11 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,17 @@ <h2>Themes</h2>
<p>
reveal.js comes with a few themes built in: <br>
<!-- Hacks to swap themes after the page has loaded. Not flexible and only intended for the reveal.js demo deck. -->
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/black.css'); return false;">Black (default)</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/white.css'); return false;">White</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/league.css'); return false;">League</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/sky.css'); return false;">Sky</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/beige.css'); return false;">Beige</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/simple.css'); return false;">Simple</a> <br>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/serif.css'); return false;">Serif</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/blood.css'); return false;">Blood</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/night.css'); return false;">Night</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/moon.css'); return false;">Moon</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/solarized.css'); return false;">Solarized</a>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/black.css'); return false;">Black (default)</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/white.css'); return false;">White</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/league.css'); return false;">League</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/sky.css'); return false;">Sky</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/beige.css'); return false;">Beige</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/simple.css'); return false;">Simple</a> <br>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/serif.css'); return false;">Serif</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/blood.css'); return false;">Blood</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/night.css'); return false;">Night</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/moon.css'); return false;">Moon</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','dist/theme/solarized.css'); return false;">Solarized</a>
</p>
</section>

Expand Down
2 changes: 1 addition & 1 deletion dist/reveal.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/reveal.esm.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/reveal.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const banner = `/*!
* Copyright (C) 2020 Hakim El Hattab, https://hakim.se
*/\n`

sass.compiler = require('node-sass');

// Prevents warnings from opening too many test pages
process.setMaxListeners(20);

Expand Down
6 changes: 6 additions & 0 deletions js/controllers/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export default class Print {
await new Promise(requestAnimationFrame);
this.Reveal.layoutSlideContents( slideWidth, slideHeight );

slides.forEach( function( slide ) {
// Re-run the slide layout so that r-fit-text is applied based on
// the printed slide size
this.Reveal.slideContent.layout( slide );
});

// Batch scrollHeight access to prevent layout thrashing
await new Promise(requestAnimationFrame);
const slideScrollHeights = []
Expand Down
6 changes: 4 additions & 2 deletions js/controllers/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,16 @@ export default class Progress {

event.preventDefault();

let slidesTotal = this.Reveal.getHorizontalSlides().length;
let slides = this.Reveal.getSlides();
let slidesTotal = slides.length;
let slideIndex = Math.floor( ( event.clientX / this.getMaxWidth() ) * slidesTotal );

if( this.Reveal.getConfig().rtl ) {
slideIndex = slidesTotal - slideIndex;
}

this.Reveal.slide( slideIndex );
let targetIndices = this.Reveal.getIndices(slides[slideIndex]);
this.Reveal.slide( targetIndices.h, targetIndices.v );

}

Expand Down
13 changes: 11 additions & 2 deletions js/controllers/slidecontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,20 @@ export default class SlideContent {

}

this.layout( slide );

}

/**
* Applies JS-dependent layout helpers for the given slide,
* if there are any.
*/
layout( slide ) {

// Autosize text with the r-fit-text class based on the
// size of its container. This needs to happen after the
// slide is visible in order to measure the text.
Array.from( slide.querySelectorAll( '.r-fit-text:not([data-fitted])' ) ).forEach( element => {
element.dataset.fitted = '';
Array.from( slide.querySelectorAll( '.r-fit-text' ) ).forEach( element => {
fitty( element, {
minSize: 24,
maxSize: this.Reveal.getConfig().height * 0.8,
Expand Down
Loading

0 comments on commit acafabf

Please sign in to comment.