add support for responsively activating reader mode via

This commit is contained in:
Hakim El Hattab
2023-10-06 09:14:23 +02:00
parent 899a45dff6
commit ab52d334df
8 changed files with 146 additions and 6 deletions

View File

@@ -999,6 +999,18 @@ export default function( revealElement, options ) {
}
});
}
// Responsively turn on the reader mode if there is an activation
// width configured. Ignore if we're configured to always be in
// reader mode.
if( typeof config.readerActivationWidth === 'number' && config.view !== 'reader' ) {
if( size.presentationWidth < config.readerActivationWidth ) {
if( !reader.isActive() ) reader.activate();
}
else {
if( reader.isActive() ) reader.deactivate();
}
}
}
dom.viewport.style.setProperty( '--slide-scale', scale );