1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-01-17 13:28:29 +01:00

fix missing backgrounds when scroll view is actived responsively (fixes #3554)

This commit is contained in:
Hakim El Hattab 2023-12-22 13:18:06 +01:00
parent 0e21a2a791
commit 5ee1f729bd
6 changed files with 41 additions and 18 deletions

2
dist/reveal.esm.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/reveal.js vendored

File diff suppressed because one or more lines are too long

2
dist/reveal.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1016,19 +1016,9 @@ export default function( revealElement, options ) {
}
});
}
}
// Responsively turn on the scroll mode if there is an activation
// width configured. Ignore if we're configured to always be in
// scroll mode.
if( typeof config.scrollActivationWidth === 'number' && config.view !== 'scroll' ) {
if( size.presentationWidth > 0 && size.presentationWidth <= config.scrollActivationWidth ) {
if( !scrollView.isActive() ) scrollView.activate();
}
else {
if( scrollView.isActive() ) scrollView.deactivate();
}
}
}
checkResponsiveScrollView();
dom.viewport.style.setProperty( '--slide-scale', scale );
dom.viewport.style.setProperty( '--viewport-width', viewportWidth + 'px' );
@ -1081,6 +1071,40 @@ export default function( revealElement, options ) {
}
/**
* Responsively activates the scroll mode when we reach the configured
* activation width.
*/
function checkResponsiveScrollView() {
// Only proceed if...
// 1. The DOM is ready
// 2. Layouts aren't disabled via config
// 3. We're not currently printing
// 4. There is a scrollActivationWidth set
// 5. The deck isn't configured to always use the scroll view
if(
dom.wrapper &&
!config.disableLayout &&
!printView.isActive() &&
typeof config.scrollActivationWidth === 'number' &&
config.view !== 'scroll'
) {
const size = getComputedSlideSize();
if( size.presentationWidth > 0 && size.presentationWidth <= config.scrollActivationWidth ) {
if( !scrollView.isActive() ) {
backgrounds.create();
scrollView.activate()
};
}
else {
if( scrollView.isActive() ) scrollView.deactivate();
}
}
}
/**
* Calculates the computed pixel size of our slides. These
* values are based on the width and height configuration
@ -2700,7 +2724,6 @@ export default function( revealElement, options ) {
function onWindowResize( event ) {
layout();
}
/**

View File

@ -1,6 +1,6 @@
{
"name": "reveal.js",
"version": "5.0.3",
"version": "5.0.4",
"description": "The HTML Presentation Framework",
"homepage": "https://revealjs.com",
"subdomain": "revealjs",