diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2024-07-04 20:56:23 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2024-07-04 20:59:57 +0200 |
commit | 078342d1974b3d52f475e5b8ea7f925d336717db (patch) | |
tree | f9644f63a91a002558378895120fe7124c2dd206 | |
parent | SlideShow: use presentation info (diff) | |
download | online-078342d1974b3d52f475e5b8ea7f925d336717db.tar.gz online-078342d1974b3d52f475e5b8ea7f925d336717db.zip |
SlideShow: extract transition handler
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: If25434889dc773546b5e2e5363106cfb8464d086
-rw-r--r-- | browser/src/slideshow/SlideShowPresenter.ts | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/browser/src/slideshow/SlideShowPresenter.ts b/browser/src/slideshow/SlideShowPresenter.ts index 47a49a726d..ccd3574dd8 100644 --- a/browser/src/slideshow/SlideShowPresenter.ts +++ b/browser/src/slideshow/SlideShowPresenter.ts @@ -71,6 +71,19 @@ class SlideShowPresenter { return canvas; } + _fetchSlide(slideNumber: number) { + return this._map._docLayer._preview._previewTiles[slideNumber].src; + } + + _doTransition(previousSlide: HTMLImageElement, nextSlideNumber: number) { + const nextSlide = new Image(); + nextSlide.src = this._fetchSlide(nextSlideNumber); + nextSlide.onload = () => { + SlideShow.FadeTransition(this._slideShowCanvas, previousSlide, nextSlide).start(3); + this._currentSlide++; + }; + } + _onFullScreen() { if (this._checkPresentationDisabled()) { this._notifyPresentationDisabled(); @@ -107,25 +120,16 @@ class SlideShowPresenter { } const doPresentation = () => { - // TODO: Replace Image here with Scaled Slide Preview - const image1 = new Image(); - const image2 = new Image(); - - /* - TODO: - logic for webgl presentation window. here are initial thoughts - - keep the context and "current slide" texture outside of the class, then on transition load the slide into next texture and add to the transition class as a parameter, - the transition class will only do transition from one texture (slide) to another texture and then get destroyed - */ - - image1.onload = () => { - image2.onload = () => { - SlideShow.FadeTransition(this._slideShowCanvas, image1, image2).start(3); - }; - image2.src = this._map._docLayer._preview._previewTiles[1].src; - }; - image1.src = this._map._docLayer._preview._previewTiles[0].src; + const previousSlide = new Image(); + + if (this._currentSlide === 0) { + // TODO: use black background as an initial slide + previousSlide.src = this._fetchSlide(0); + } else { + previousSlide.src = this._fetchSlide(this._currentSlide); + } + + this._doTransition(previousSlide, this._currentSlide); L.DomEvent.on( document, |