activate()

in js/controllers/overview.js [24:79]


	activate() {

		// Only proceed if enabled in config
		if( this.Reveal.getConfig().overview && !this.isActive() ) {

			this.active = true;

			this.Reveal.getRevealElement().classList.add( 'overview' );

			// Don't auto-slide while in overview mode
			this.Reveal.cancelAutoSlide();

			// Move the backgrounds element into the slide container to
			// that the same scaling is applied
			this.Reveal.getSlidesElement().appendChild( this.Reveal.getBackgroundsElement() );

			// Clicking on an overview slide navigates to it
			queryAll( this.Reveal.getRevealElement(), SLIDES_SELECTOR ).forEach( slide => {
				if( !slide.classList.contains( 'stack' ) ) {
					slide.addEventListener( 'click', this.onSlideClicked, true );
				}
			} );

			// Calculate slide sizes
			const margin = 70;
			const slideSize = this.Reveal.getComputedSlideSize();
			this.overviewSlideWidth = slideSize.width + margin;
			this.overviewSlideHeight = slideSize.height + margin;

			// Reverse in RTL mode
			if( this.Reveal.getConfig().rtl ) {
				this.overviewSlideWidth = -this.overviewSlideWidth;
			}

			this.Reveal.updateSlidesVisibility();

			this.layout();
			this.update();

			this.Reveal.layout();

			const indices = this.Reveal.getIndices();

			// Notify observers of the overview showing
			this.Reveal.dispatchEvent({
				type: 'overviewshown',
				data: {
					'indexh': indices.h,
					'indexv': indices.v,
					'currentSlide': this.Reveal.getCurrentSlide()
				}
			});

		}

	}