diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-07-13 14:29:19 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-07-13 14:29:19 +0200 |
commit | f2d7195922bd72167f2a01ea10419296bc2e915a (patch) | |
tree | 4a29035f0353a9561660b5358b0374b6f84ed0a4 /geschichte/js/controllers/progress.js | |
parent | chore(src/data/hello.sh): Remove (diff) | |
download | b-peetz.de-f2d7195922bd72167f2a01ea10419296bc2e915a.zip |
chore(geschichte): Remove
This is also irrelevant, as it is no longer used.
Diffstat (limited to 'geschichte/js/controllers/progress.js')
-rw-r--r-- | geschichte/js/controllers/progress.js | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/geschichte/js/controllers/progress.js b/geschichte/js/controllers/progress.js deleted file mode 100644 index 87e2aaf..0000000 --- a/geschichte/js/controllers/progress.js +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Creates a visual progress bar for the presentation. - */ -export default class Progress { - - constructor( Reveal ) { - - this.Reveal = Reveal; - - this.onProgressClicked = this.onProgressClicked.bind( this ); - - } - - render() { - - this.element = document.createElement( 'div' ); - this.element.className = 'progress'; - this.Reveal.getRevealElement().appendChild( this.element ); - - this.bar = document.createElement( 'span' ); - this.element.appendChild( this.bar ); - - } - - /** - * Called when the reveal.js config is updated. - */ - configure( config, oldConfig ) { - - this.element.style.display = config.progress ? 'block' : 'none'; - - } - - bind() { - - if( this.Reveal.getConfig().progress && this.element ) { - this.element.addEventListener( 'click', this.onProgressClicked, false ); - } - - } - - unbind() { - - if ( this.Reveal.getConfig().progress && this.element ) { - this.element.removeEventListener( 'click', this.onProgressClicked, false ); - } - - } - - /** - * Updates the progress bar to reflect the current slide. - */ - update() { - - // Update progress if enabled - if( this.Reveal.getConfig().progress && this.bar ) { - - let scale = this.Reveal.getProgress(); - - // Don't fill the progress bar if there's only one slide - if( this.Reveal.getTotalSlides() < 2 ) { - scale = 0; - } - - this.bar.style.transform = 'scaleX('+ scale +')'; - - } - - } - - getMaxWidth() { - - return this.Reveal.getRevealElement().offsetWidth; - - } - - /** - * Clicking on the progress bar results in a navigation to the - * closest approximate horizontal slide using this equation: - * - * ( clickX / presentationWidth ) * numberOfSlides - * - * @param {object} event - */ - onProgressClicked( event ) { - - this.Reveal.onUserInput( event ); - - event.preventDefault(); - - let slides = this.Reveal.getSlides(); - let slidesTotal = slides.length; - let slideIndex = Math.floor( ( event.clientX / this.getMaxWidth() ) * slidesTotal ); - - if( this.Reveal.getConfig().rtl ) { - slideIndex = slidesTotal - slideIndex; - } - - let targetIndices = this.Reveal.getIndices(slides[slideIndex]); - this.Reveal.slide( targetIndices.h, targetIndices.v ); - - } - - destroy() { - - this.element.remove(); - - } - -} \ No newline at end of file |