@@ -174,9 +174,35 @@ BookReader.prototype.setup = function(options) {
174174 /** @deprecated */
175175 this . bookPath = options . bookPath ;
176176 this . fader = utils . debounce (
177- ( ) => $ ( document . body ) . addClass ( 'faded' ) ,
177+ ( source ) => {
178+ console . log ( 'Fading UI' ) ;
179+ $ ( document . body )
180+ . addClass ( 'faded' )
181+ . toggleClass ( 'faded--scroll' , source === 'scroll' ) ;
182+ // const animation = this.$('.BRfooter')[0].getAnimations()[0];
183+ // if (!animation) return;
184+ // if (source === 'scroll') animation.pause();
185+ // animation.currentTime = 0;
186+ } ,
178187 2000 ,
179- ( ) => $ ( document . body ) . removeClass ( 'faded' ) ,
188+ ( source ) => {
189+ console . log ( 'Show UI' ) ;
190+ $ ( document . body )
191+ . removeClass ( 'faded' )
192+ . toggleClass ( 'faded--scroll' , source === 'scroll' ) ;
193+ } ,
194+ {
195+ tap : ( source ) => {
196+ console . log ( 'Show UI ...' , source ) ;
197+ // if (source === 'scroll') {
198+ // const animation = this.$('.BRfooter')[0].getAnimations()[0];
199+ // if (animation) {
200+ // // const max = animation.effect.getComputedTiming().duration;
201+ // animation.currentTime += 1;
202+ // }
203+ // }
204+ } ,
205+ } ,
180206 ) ;
181207
182208 // Construct the usual plugins first to get type hints
@@ -747,8 +773,8 @@ BookReader.prototype.init = function() {
747773 }
748774 }
749775
750- this . refs . $br . on ( 'mousemove' , this . fader ) ;
751- this . refs . $brContainer . on ( 'scroll' , utils . onScrollUp ( this . fader ) ) ;
776+ this . refs . $br . on ( 'mousemove' , ( ) => this . fader ( 'mousemove' ) ) ;
777+ this . refs . $brContainer [ 0 ] . addEventListener ( 'scroll' , utils . eventFilterScrollUp ( ( ) => this . fader ( 'scroll' ) ) , { passive : true } ) ;
752778
753779 this . init . initComplete = true ;
754780 this . trigger ( BookReader . eventNames . PostInit ) ;
@@ -1986,6 +2012,7 @@ BookReader.prototype.queryStringFromParams = function(
19862012
19872013/**
19882014 * Helper to select within instance's elements
2015+ * @returns {JQuery<HTMLElement> }
19892016 */
19902017BookReader . prototype . $ = function ( selector ) {
19912018 return this . refs . $br . find ( selector ) ;
0 commit comments