started work on slideshow feature -- ui still in design...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-03-12 06:24:35 +03:00
parent d6f1e40844
commit 0e34d92a4d
4 changed files with 105 additions and 7 deletions

View File

@ -18,6 +18,7 @@ var ui = require('features/ui')
var status = require('features/ui-status') var status = require('features/ui-status')
var marks = require('features/ui-marks') var marks = require('features/ui-marks')
var widgets = require('features/ui-widgets') var widgets = require('features/ui-widgets')
var slideshow = require('features/ui-slideshow')
var exteditor = require('features/external-editor') var exteditor = require('features/external-editor')
var metadata = require('features/metadata') var metadata = require('features/metadata')
var meta = require('features/meta') var meta = require('features/meta')

View File

@ -111,6 +111,9 @@ core.ImageGridFeatures.Feature('viewer-testing', [
'ui-context-action-menu', 'ui-context-action-menu',
'ui-widget-test', 'ui-widget-test',
// slideshow...
'ui-slideshow',
// ui control... // ui control...
'ui-clickable', 'ui-clickable',
//'ui-autohide-cursor', //'ui-autohide-cursor',

View File

@ -0,0 +1,90 @@
/**********************************************************************
*
*
*
**********************************************************************/
define(function(require){ var module = {}
//var DEBUG = DEBUG != null ? DEBUG : true
var toggler = require('lib/toggler')
var actions = require('lib/actions')
var features = require('lib/features')
var core = require('features/core')
var base = require('features/base')
/*********************************************************************/
// XXX stub...
var SlideshowActions = actions.Actions({
config: {
},
// XXX
// /Slideshow/
// Interval (3)/ -- not a toggler
// 0.2
// 1
// 3*
// 5
// Custom... -- click to edit
// Direction (forward)/
// forward*
// revrse
// Looping (on)/
// on*
// off
// Start
// XXX need to set the default value in title...
// XXX might be a good idea to make this with an editable value...
// i.e.
// Interval: 3s / -- 3s is editable...
// 0.2 x -- a history of values that can be
// selected w/o closing the dialog
// or can be removed...
// 1 x
// 3 x
// Custom... -- editable/placeholder... 'enter'
// selects value and adds it to
// history...
selectSlideshowInterval: ['Slideshow/Interval/*',
// XXX make this a custom menu rather than a lister... (???)
function(path, make){
make('0.2')
make('1')
make('3')
make('Custom...')
}],
toggleSlideshowDirection: ['Slideshow/Direction',
function(){}],
toggleSlideshowLooping: ['Slideshow/Looping',
function(){}],
toggleSlideshow: ['Slideshow/Start',
function(){}],
})
var Slideshow =
module.Slideshow = core.ImageGridFeatures.Feature({
title: '',
doc: '',
tag: 'ui-slideshow',
depends: [
'ui',
],
actions: SlideshowActions,
})
/**********************************************************************
* vim:set ts=4 sw=4 : */
return module })

View File

@ -40,7 +40,7 @@ var makeActionLister = function(list, filter, pre_order){
return function(path, inline_state){ return function(path, inline_state){
inline_state = inline_state == null ? inline_state = inline_state == null ?
that.config['actions-list-show-toggler-state-inline'] this.config['actions-list-show-toggler-state-inline']
: inline_state : inline_state
var that = this var that = this
@ -62,6 +62,13 @@ var makeActionLister = function(list, filter, pre_order){
var n = paths[k][0] var n = paths[k][0]
var k = filter ? filter(k, n) : k var k = filter ? filter(k, n) : k
// prepare for toggler stuff...
var isToggler = that.isToggler && that.isToggler(n) || false
if(isToggler){
var cur_state = that[n]('?')
k = k +(inline_state ? (' ('+ cur_state +')') : '')
}
// XXX this expects that .client will trigger an open event... // XXX this expects that .client will trigger an open event...
var waitFor = function(child){ var waitFor = function(child){
// we got a widget, wait for it to close... // we got a widget, wait for it to close...
@ -85,19 +92,16 @@ var makeActionLister = function(list, filter, pre_order){
} }
// toggler -- add state list... // toggler -- add state list...
if(that.isToggler && that.isToggler(n)){ if(isToggler){
var states = that[n]('??') var states = that[n]('??')
var cur = that[n]('?')
// bool toggler... // bool toggler...
if(cur == 'on' || cur == 'off'){ if(cur_state == 'on' || cur_state == 'off'){
states = ['off', 'on'] states = ['off', 'on']
} }
states.forEach(function(state){ states.forEach(function(state){
//actions[k +'/'+ state + (cur == state ? ' *': '')] = actions[k +'/'+ state + (cur_state == state ? ' *': '')] =
actions[k +(inline_state ? (' ('+ cur +')') : '')
+'/'+ state + (cur == state ? ' *': '')] =
function(){ function(){
that[n](state) that[n](state)
} }