mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +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',
|
tag: 'ui-slideshow',
|
||||||
depends: [
|
depends: [
|
||||||
'ui',
|
'ui',
|
||||||
|
'ui-control',
|
||||||
'ui-single-image',
|
'ui-single-image',
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -354,40 +355,41 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var toggle_debounce = false
|
||||||
|
|
||||||
var hold = this.__slideshow_hold_handler
|
var hold = this.__slideshow_hold_handler
|
||||||
= this.__slideshow_hold_handler
|
= this.__slideshow_hold_handler
|
||||||
|| function(){
|
|| function(evt){
|
||||||
var h = that.__slideshow_holding
|
!toggle_debounce
|
||||||
|
&& that.toggleSlideshowTimer('?') == 'running'
|
||||||
if(h == null && that.toggleSlideshowTimer('?') == 'running'){
|
&& that.suspendSlideshowTimer() }
|
||||||
that.__slideshow_holding = 1
|
|
||||||
that.suspendSlideshowTimer()
|
|
||||||
|
|
||||||
// handle multiple events stacked...
|
|
||||||
} else {
|
|
||||||
that.__slideshow_holding += 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var release = this.__slideshow_release_handler
|
var release = this.__slideshow_release_handler
|
||||||
= 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(){
|
|| function(){
|
||||||
var h = that.__slideshow_holding =
|
if(!toggle_debounce){
|
||||||
// unstack multiple events...
|
that.toggleSlideshowTimer()
|
||||||
(that.__slideshow_holding || -1) - 1
|
toggle_debounce = true
|
||||||
|
setTimeout(function(){
|
||||||
if(h == 0){
|
toggle_debounce = false
|
||||||
that.resetSlideshowTimer()
|
}, that.config['image-click-debounce-timeout'] || 100)
|
||||||
delete that.__slideshow_holding
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.toggleSlideshow('?') == 'on'){
|
if(this.toggleSlideshow('?') == 'on'){
|
||||||
this.dom.on('keydown mousedown', hold)
|
this.dom.on('mousedown', hold)
|
||||||
this.dom.on('keydown mouseup', release)
|
this.dom.on('mouseup', release)
|
||||||
|
this.dom.on('tap', toggle)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.dom.off('keyup mousedown', hold)
|
this.dom.off('mousedown', hold)
|
||||||
this.dom.off('keyup mouseup', release)
|
this.dom.off('mouseup', release)
|
||||||
|
this.dom.off('touchend', toggle)
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
//*/
|
//*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user