Skip to content

Commit

Permalink
tweaks for #3568
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Feb 5, 2024
1 parent 67b5ec1 commit 18ec38a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.js.map

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions js/controllers/scrollview.js
@@ -1,4 +1,4 @@
import { HORIZONTAL_SLIDES_SELECTOR, SLIDES_BACKGROUNDS_SELECTOR } from '../utils/constants.js'
import { HORIZONTAL_SLIDES_SELECTOR, HORIZONTAL_BACKGROUNDS_SELECTOR } from '../utils/constants.js'
import { queryAll } from '../utils/util.js'

const HIDE_SCROLLBAR_TIMEOUT = 500;
Expand Down Expand Up @@ -40,7 +40,7 @@ export default class ScrollView {
this.slideHTMLBeforeActivation = this.Reveal.getSlidesElement().innerHTML;

const horizontalSlides = queryAll( this.Reveal.getRevealElement(), HORIZONTAL_SLIDES_SELECTOR );
const slideBackgrounds = queryAll( this.Reveal.getRevealElement(), SLIDES_BACKGROUNDS_SELECTOR );
const horizontalBackgrounds = queryAll( this.Reveal.getRevealElement(), HORIZONTAL_BACKGROUNDS_SELECTOR );

this.viewportElement.classList.add( 'loading-scroll-mode', 'reveal-scroll' );

Expand All @@ -58,7 +58,7 @@ export default class ScrollView {

// Creates a new page element and appends the given slide/bg
// to it.
const createPageElement = ( slide, h, v ) => {
const createPageElement = ( slide, h, v, isVertical ) => {

let contentContainer;

Expand All @@ -78,15 +78,16 @@ export default class ScrollView {
pageElements.push( page );

// This transfers over the background of the vertical stack containing
// the slide if it exists. Otherwise, it uses the presentation-wide
// background.
if( slideBackgrounds && slideBackgrounds.length > h ) {
const slideBackground = slideBackgrounds[h];
// the slide if it exists. Otherwise, it uses the presentation-wide
// background.
if( isVertical && horizontalBackgrounds.length > h ) {
const slideBackground = horizontalBackgrounds[h];
const pageBackground = window.getComputedStyle( slideBackground );

if( pageBackground && pageBackground.background ) {
page.style.background = pageBackground.background;
} else if( presentationBackground ) {
}
else if( presentationBackground ) {
page.style.background = presentationBackground;
}
} else if( presentationBackground ) {
Expand Down Expand Up @@ -122,7 +123,7 @@ export default class ScrollView {

if( this.Reveal.isVerticalStack( horizontalSlide ) ) {
horizontalSlide.querySelectorAll( 'section' ).forEach( ( verticalSlide, v ) => {
createPageElement( verticalSlide, h, v );
createPageElement( verticalSlide, h, v, true );
});
}
else {
Expand Down
2 changes: 1 addition & 1 deletion js/utils/constants.js
Expand Up @@ -2,7 +2,7 @@
export const SLIDES_SELECTOR = '.slides section';
export const HORIZONTAL_SLIDES_SELECTOR = '.slides>section';
export const VERTICAL_SLIDES_SELECTOR = '.slides>section.present>section';
export const SLIDES_BACKGROUNDS_SELECTOR = '.backgrounds>.slide-background';
export const HORIZONTAL_BACKGROUNDS_SELECTOR = '.backgrounds>.slide-background';

// Methods that may not be invoked via the postMessage API
export const POST_MESSAGE_METHOD_BLACKLIST = /registerPlugin|registerKeyboardShortcut|addKeyBinding|addEventListener|showPreview/;
Expand Down

0 comments on commit 18ec38a

Please sign in to comment.