emmit resize event if scale changed
This commit is contained in:
parent
0b3e7839eb
commit
abee356e42
|
@ -958,6 +958,14 @@ Limitations:
|
||||||
- Only direct descendants of a slide section can be stretched
|
- Only direct descendants of a slide section can be stretched
|
||||||
- Only one descendant per slide section can be stretched
|
- Only one descendant per slide section can be stretched
|
||||||
|
|
||||||
|
### Resize Event
|
||||||
|
|
||||||
|
When reveal.js changes the scale of the slides it fires an resize event. You can subscribe to the event to resize your elements accordingly.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
Reveal.addEventListener( 'overviewshown', function( event ) { /* console.log(event.scale,event.oldscale,event.size); */ } );
|
||||||
|
```
|
||||||
|
|
||||||
### postMessage API
|
### postMessage API
|
||||||
|
|
||||||
The framework has a built-in postMessage API that can be used when communicating with a presentation inside of another window. Here's an example showing how you'd make a reveal.js instance in the given window proceed to slide 2:
|
The framework has a built-in postMessage API that can be used when communicating with a presentation inside of another window. Here's an example showing how you'd make a reveal.js instance in the given window proceed to slide 2:
|
||||||
|
|
|
@ -1971,6 +1971,7 @@
|
||||||
dom.slides.style.height = size.height + 'px';
|
dom.slides.style.height = size.height + 'px';
|
||||||
|
|
||||||
// Determine scale of content to fit within available space
|
// Determine scale of content to fit within available space
|
||||||
|
var oldscale =scale;
|
||||||
scale = Math.min( size.presentationWidth / size.width, size.presentationHeight / size.height );
|
scale = Math.min( size.presentationWidth / size.width, size.presentationHeight / size.height );
|
||||||
|
|
||||||
// Respect max/min scale settings
|
// Respect max/min scale settings
|
||||||
|
@ -2036,6 +2037,13 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( oldscale!==scale ){
|
||||||
|
dispatchEvent( 'resize', {
|
||||||
|
'oldscale': oldscale,
|
||||||
|
'scale': scale,
|
||||||
|
'size': size
|
||||||
|
} );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProgress();
|
updateProgress();
|
||||||
|
|
Loading…
Reference in New Issue