mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
reworked slideshow pausing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
618a872c02
commit
ea773dafd4
@ -318,21 +318,27 @@ button:hover {
|
|||||||
position: relative;
|
position: relative;
|
||||||
float: left;
|
float: left;
|
||||||
|
|
||||||
opacity: 0.4;
|
|
||||||
|
|
||||||
size: 30px;
|
size: 30px;
|
||||||
|
|
||||||
cursor: default;
|
cursor: default;
|
||||||
|
|
||||||
z-index: 4000;
|
z-index: 4000;
|
||||||
}
|
}
|
||||||
.buttons:hover {
|
|
||||||
|
/* general button visibility */
|
||||||
|
.buttons .button {
|
||||||
|
opacity: 0.4;
|
||||||
|
}
|
||||||
|
.buttons:hover .button {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
.light .buttons {
|
.buttons .button.visible {
|
||||||
|
opacity: 1 !important;
|
||||||
|
}
|
||||||
|
.light .buttons .button {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
.dark .buttons {
|
.dark .buttons .button {
|
||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,16 +400,11 @@ button:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* main buttons... */
|
/* main buttons... */
|
||||||
.main-buttons.buttons {
|
.main-buttons.buttons {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
left: 0px;
|
left: 0px;
|
||||||
}
|
}
|
||||||
.main-buttons.buttons:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* secondary buttons... */
|
/* secondary buttons... */
|
||||||
@ -411,9 +412,6 @@ button:hover {
|
|||||||
top: 0px;
|
top: 0px;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
.secondary-buttons.buttons:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
.secondary-buttons.buttons {
|
.secondary-buttons.buttons {
|
||||||
top: 40px;
|
top: 40px;
|
||||||
@ -432,9 +430,6 @@ button:hover {
|
|||||||
|
|
||||||
z-index: 9999;
|
z-index: 9999;
|
||||||
}
|
}
|
||||||
.app-buttons.buttons:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
.app-buttons .button.close:hover {
|
.app-buttons .button.close:hover {
|
||||||
background: rgba(255, 0, 0, 0.8);
|
background: rgba(255, 0, 0, 0.8);
|
||||||
}
|
}
|
||||||
@ -538,12 +533,12 @@ button:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* XXX not sure if this is the right way to go... */
|
/* XXX not sure if this is the right way to go... */
|
||||||
.single-image-mode .main-buttons,
|
.single-image-mode .main-buttons:not(:hover) .button,
|
||||||
.single-image-mode .app-buttons {
|
.single-image-mode .app-buttons:not(:hover) .button {
|
||||||
opacity: 0.1;
|
opacity: 0.1;
|
||||||
}
|
}
|
||||||
.slideshow-running .main-buttons,
|
.slideshow-running .main-buttons:not(:hover) .button,
|
||||||
.slideshow-running .app-buttons {
|
.slideshow-running .app-buttons:not(:hover) .button {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@ var SlideshowActions = actions.Actions({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// XXX should this take the slideshow off pause if paused???
|
||||||
toggleSlideshow: ['Slideshow/$Slideshow quick toggle',
|
toggleSlideshow: ['Slideshow/$Slideshow quick toggle',
|
||||||
toggler.CSSClassToggler(
|
toggler.CSSClassToggler(
|
||||||
function(){ return this.dom },
|
function(){ return this.dom },
|
||||||
@ -183,6 +184,14 @@ var SlideshowActions = actions.Actions({
|
|||||||
return o
|
return o
|
||||||
})],
|
})],
|
||||||
|
|
||||||
|
slideshowButtonAction: ['- Slideshow/',
|
||||||
|
core.doc`
|
||||||
|
`,
|
||||||
|
function(){
|
||||||
|
return this.toggleSlideshowTimer('?') == 'paused' ?
|
||||||
|
(this.toggleSlideshowTimer() && 'on')
|
||||||
|
: this.toggleSlideshow() }],
|
||||||
|
|
||||||
// settings...
|
// settings...
|
||||||
// NOTE: these are disabled as they are repeated in the slideshow dialog...
|
// NOTE: these are disabled as they are repeated in the slideshow dialog...
|
||||||
// XXX do we need both these and the dialog???
|
// XXX do we need both these and the dialog???
|
||||||
@ -241,7 +250,7 @@ var SlideshowActions = actions.Actions({
|
|||||||
this.__slideshow_timer = 'suspended'
|
this.__slideshow_timer = 'suspended'
|
||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
toggleSlideshowTimer:['Slideshow/Pause or resume running slideshow',
|
toggleSlideshowTimer: ['Slideshow/Pause or resume running slideshow',
|
||||||
core.doc`
|
core.doc`
|
||||||
|
|
||||||
NOTE: this will have no effect if the slideshow is not running...
|
NOTE: this will have no effect if the slideshow is not running...
|
||||||
@ -250,8 +259,10 @@ var SlideshowActions = actions.Actions({
|
|||||||
toggler.Toggler(null,
|
toggler.Toggler(null,
|
||||||
function(_, state){
|
function(_, state){
|
||||||
if(state == null){
|
if(state == null){
|
||||||
return this.__slideshow_timer == 'suspended' ? 'paused'
|
return this.__slideshow_timer == 'suspended' ?
|
||||||
: !!this.__slideshow_timer ? 'running'
|
'paused'
|
||||||
|
: !!this.__slideshow_timer ?
|
||||||
|
'running'
|
||||||
: 'off'
|
: 'off'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,12 +352,7 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
|||||||
['stop',
|
['stop',
|
||||||
function(){ this.toggleSlideshow('off') }],
|
function(){ this.toggleSlideshow('off') }],
|
||||||
|
|
||||||
// slideshow hold...
|
// slideshow pause...
|
||||||
//
|
|
||||||
// Holding down a key or mouse button will suspend the slideshow
|
|
||||||
// and resume it when the key/button is released...
|
|
||||||
//
|
|
||||||
// XXX experimental, needs more testing...
|
|
||||||
['toggleSlideshow',
|
['toggleSlideshow',
|
||||||
function(){
|
function(){
|
||||||
var that = this
|
var that = this
|
||||||
@ -355,20 +361,10 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var running = this.toggleSlideshow('?') == 'on'
|
||||||
var toggle_debounce = false
|
var toggle_debounce = false
|
||||||
|
|
||||||
var hold = this.__slideshow_hold_handler
|
// toggle on click...
|
||||||
= this.__slideshow_hold_handler
|
|
||||||
|| 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
|
var toggle = this.__slideshow_toggle_handler
|
||||||
= this.__slideshow_toggle_handler
|
= this.__slideshow_toggle_handler
|
||||||
|| function(){
|
|| function(){
|
||||||
@ -377,22 +373,35 @@ module.Slideshow = core.ImageGridFeatures.Feature({
|
|||||||
toggle_debounce = true
|
toggle_debounce = true
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
toggle_debounce = false
|
toggle_debounce = false
|
||||||
}, that.config['image-click-debounce-timeout'] || 100)
|
}, that.config['image-click-debounce-timeout'] || 100) } }
|
||||||
}
|
running ?
|
||||||
}
|
this.dom.on('click', toggle)
|
||||||
|
: this.dom.off('click', toggle)
|
||||||
|
|
||||||
if(this.toggleSlideshow('?') == 'on'){
|
// toggle on blur/focus...
|
||||||
this.dom.on('mousedown', hold)
|
var user_paused = false
|
||||||
this.dom.on('mouseup', release)
|
var focus_debounce = false
|
||||||
this.dom.on('tap', toggle)
|
var blur = this.__slideshow_blur_handler
|
||||||
|
= this.__slideshow_blur_handler
|
||||||
} else {
|
|| function(){
|
||||||
this.dom.off('mousedown', hold)
|
if(!focus_debounce){
|
||||||
this.dom.off('mouseup', release)
|
user_paused = that.toggleSlideshowTimer('?') == 'paused'
|
||||||
this.dom.off('touchend', toggle)
|
that.toggleSlideshowTimer('paused')
|
||||||
}
|
focus_debounce = true } }
|
||||||
|
var focus = this.__slideshow_focus_handler
|
||||||
|
= this.__slideshow_focus_handler
|
||||||
|
|| function(){
|
||||||
|
focus_debounce = false
|
||||||
|
user_paused
|
||||||
|
|| that.toggleSlideshowTimer('running') }
|
||||||
|
running ?
|
||||||
|
this.dom
|
||||||
|
.on('blur', blur)
|
||||||
|
.on('focus', focus)
|
||||||
|
: this.dom
|
||||||
|
.off('blur', blur)
|
||||||
|
.off('focus', focus)
|
||||||
}],
|
}],
|
||||||
//*/
|
|
||||||
|
|
||||||
// pause/resume slideshow on modal stuff...
|
// pause/resume slideshow on modal stuff...
|
||||||
['firstModalOpen',
|
['firstModalOpen',
|
||||||
|
|||||||
@ -2247,7 +2247,7 @@ var ButtonsActions = actions.Actions({
|
|||||||
]],
|
]],
|
||||||
'C<sub/>': ['crop', 'browseActions: "Crop/" -- Crop menu...'],
|
'C<sub/>': ['crop', 'browseActions: "Crop/" -- Crop menu...'],
|
||||||
'▷': ['slideshow', [
|
'▷': ['slideshow', [
|
||||||
'toggleSlideshow -- Slideshow',
|
'slideshowButtonAction -- Slideshow',
|
||||||
'slideshowDialog -- Slideshow menu...',
|
'slideshowDialog -- Slideshow menu...',
|
||||||
]],
|
]],
|
||||||
},
|
},
|
||||||
@ -2411,8 +2411,10 @@ module.Buttons = core.ImageGridFeatures.Feature({
|
|||||||
'width': '0px',
|
'width': '0px',
|
||||||
'overflow': 'visible',
|
'overflow': 'visible',
|
||||||
})
|
})
|
||||||
.text(l > 99 ? '99+'
|
.text(l > 99 ?
|
||||||
: l == 0 ? ''
|
'99+'
|
||||||
|
: l == 0 ?
|
||||||
|
''
|
||||||
: l)
|
: l)
|
||||||
/*
|
/*
|
||||||
$('.main-buttons.buttons .collections.button sub')
|
$('.main-buttons.buttons .collections.button sub')
|
||||||
@ -2427,14 +2429,25 @@ module.Buttons = core.ImageGridFeatures.Feature({
|
|||||||
//*/
|
//*/
|
||||||
}],
|
}],
|
||||||
// update slideshow status...
|
// update slideshow status...
|
||||||
['toggleSlideshow',
|
[['toggleSlideshow', 'toggleSlideshowTimer'],
|
||||||
function(){
|
function(){
|
||||||
|
var mode = this.toggleSlideshow('?')
|
||||||
|
mode = (mode == 'on'
|
||||||
|
&& this.toggleSlideshowTimer('?') == 'paused') ?
|
||||||
|
'paused'
|
||||||
|
: mode
|
||||||
|
// update the button icon...
|
||||||
$('.main-buttons.buttons .slideshow.button')
|
$('.main-buttons.buttons .slideshow.button')
|
||||||
.html(this.toggleSlideshow('?') == 'on' ?
|
.html(mode == 'on' ?
|
||||||
'◼'
|
'◼'
|
||||||
|
: mode == 'paused' ?
|
||||||
|
'❚❚'
|
||||||
//'◻'
|
//'◻'
|
||||||
: '▷')
|
: '▷')
|
||||||
}],
|
.run(function(){
|
||||||
|
mode == 'paused' ?
|
||||||
|
this.addClass('visible')
|
||||||
|
: this.removeClass('visible') }) }],
|
||||||
// update zoom button status...
|
// update zoom button status...
|
||||||
['viewScale',
|
['viewScale',
|
||||||
function(){
|
function(){
|
||||||
|
|||||||
@ -1314,6 +1314,15 @@ var BaseBrowserPrototype = {
|
|||||||
// NOTE: this may or may not be a Browser object.
|
// NOTE: this may or may not be a Browser object.
|
||||||
parent: null,
|
parent: null,
|
||||||
|
|
||||||
|
// Root dialog...
|
||||||
|
//
|
||||||
|
get root(){
|
||||||
|
var cur = this
|
||||||
|
while(cur.parent instanceof BaseBrowser){
|
||||||
|
cur = cur.parent
|
||||||
|
}
|
||||||
|
return cur },
|
||||||
|
|
||||||
// Section containers...
|
// Section containers...
|
||||||
//
|
//
|
||||||
// Format:
|
// Format:
|
||||||
@ -5180,8 +5189,16 @@ var HTMLBrowserPrototype = {
|
|||||||
that.dom
|
that.dom
|
||||||
&& that.dom.focus() }) },
|
&& that.dom.focus() }) },
|
||||||
__open__: function(evt, elem){ this.focus(elem) },
|
__open__: function(evt, elem){ this.focus(elem) },
|
||||||
|
//* XXX there is a problem with .update() propagation up the nested
|
||||||
|
// dialogs -- we lose context...
|
||||||
|
// ...see .renderContext(..) / .renderFinalize(..) for details...
|
||||||
__expand__: function(){ this.update() },
|
__expand__: function(){ this.update() },
|
||||||
__collapse__: function(){ this.update() },
|
__collapse__: function(){ this.update() },
|
||||||
|
/*/
|
||||||
|
// XXX this is a hack -- we should fix the actual update propagation and revert to the above...
|
||||||
|
__expand__: function(){ this.root.update() },
|
||||||
|
__collapse__: function(){ this.root.update() },
|
||||||
|
//*/
|
||||||
__select__: updateElemClass('add', 'selected'),
|
__select__: updateElemClass('add', 'selected'),
|
||||||
__deselect__: updateElemClass('remove', 'selected'),
|
__deselect__: updateElemClass('remove', 'selected'),
|
||||||
__disable__: updateElemClass('add', 'disabled', function(){ this.update() }),
|
__disable__: updateElemClass('add', 'disabled', function(){ this.update() }),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user