mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
fixed a couple of bugs and reworked slideshow control...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2a9a398734
commit
17570a0e8b
@ -288,6 +288,7 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
||||
tag: 'ui-slideshow',
|
||||
depends: [
|
||||
'ui',
|
||||
'ui-control',
|
||||
'ui-single-image',
|
||||
],
|
||||
|
||||
@ -354,40 +355,41 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
||||
return
|
||||
}
|
||||
|
||||
var toggle_debounce = false
|
||||
|
||||
var hold = this.__slideshow_hold_handler
|
||||
= this.__slideshow_hold_handler
|
||||
|| function(){
|
||||
var h = that.__slideshow_holding
|
||||
|
||||
if(h == null && that.toggleSlideshowTimer('?') == 'running'){
|
||||
that.__slideshow_holding = 1
|
||||
that.suspendSlideshowTimer()
|
||||
|
||||
// handle multiple events stacked...
|
||||
} else {
|
||||
that.__slideshow_holding += 1
|
||||
}
|
||||
}
|
||||
|| function(evt){
|
||||
!toggle_debounce
|
||||
&& that.toggleSlideshowTimer('?') == 'running'
|
||||
&& that.suspendSlideshowTimer() }
|
||||
var release = this.__slideshow_release_handler
|
||||
= this.__slideshow_release_handler
|
||||
|| function(evt){
|
||||
!toggle_debounce
|
||||
&& that.toggleSlideshowTimer('?') != 'running'
|
||||
&& that.resetSlideshowTimer() }
|
||||
var toggle = this.__slideshow_toggle_handler
|
||||
= this.__slideshow_toggle_handler
|
||||
|| function(){
|
||||
var h = that.__slideshow_holding =
|
||||
// unstack multiple events...
|
||||
(that.__slideshow_holding || -1) - 1
|
||||
|
||||
if(h == 0){
|
||||
that.resetSlideshowTimer()
|
||||
delete that.__slideshow_holding
|
||||
if(!toggle_debounce){
|
||||
that.toggleSlideshowTimer()
|
||||
toggle_debounce = true
|
||||
setTimeout(function(){
|
||||
toggle_debounce = false
|
||||
}, that.config['image-click-debounce-timeout'] || 100)
|
||||
}
|
||||
}
|
||||
|
||||
if(this.toggleSlideshow('?') == 'on'){
|
||||
this.dom.on('keydown mousedown', hold)
|
||||
this.dom.on('keydown mouseup', release)
|
||||
this.dom.on('mousedown', hold)
|
||||
this.dom.on('mouseup', release)
|
||||
this.dom.on('tap', toggle)
|
||||
|
||||
} else {
|
||||
this.dom.off('keyup mousedown', hold)
|
||||
this.dom.off('keyup mouseup', release)
|
||||
this.dom.off('mousedown', hold)
|
||||
this.dom.off('mouseup', release)
|
||||
this.dom.off('touchend', toggle)
|
||||
}
|
||||
}]
|
||||
//*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user