From ac20f12176b6624d145df3729b3b13af92c5d483 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 10 Jun 2013 16:10:16 +0400 Subject: [PATCH] tweaking... Signed-off-by: Alex A. Naanou --- ui/base.js | 3 +++ ui/index.html | 14 +++++++++++--- ui/layout.css | 1 + ui/layout.less | 2 ++ ui/lib/jli.js | 26 ++++++++++++++++++++++++++ ui/lib/scroller.js | 6 ++++++ ui/modes.js | 10 ++++++++++ 7 files changed, 59 insertions(+), 3 deletions(-) diff --git a/ui/base.js b/ui/base.js index 26c3bfc9..8c8f3465 100755 --- a/ui/base.js +++ b/ui/base.js @@ -31,6 +31,9 @@ var NAV_RIBBON_VISIBLE = ':visible' var NAV_RIBBON_DEFAULT = NAV_RIBBON_ALL //var NAV_RIBBON_DEFAULT = NAV_RIBBON_VISIBLE +// can be: +// - animate +// - css var TRANSITION_MODE_DEFAULT = 'animate' var MAX_SCREEN_IMAGES = 12 diff --git a/ui/index.html b/ui/index.html index 172706d1..403b1d61 100755 --- a/ui/index.html +++ b/ui/index.html @@ -77,6 +77,11 @@ less = { //DEBUG = true var SCROLLER_ENABLED = true +var SCROLLER_ANIMATE_DURATION = 100 +// XXX scroller transitions not yet ready... +// ...need to disable transitions on some actions (where we +// explicitly say 'css') +//var TRANSITION_MODE_DEFAULT = 'css' // setup... $(function(){ @@ -99,7 +104,7 @@ $(function(){ if(SCROLLER_ENABLED){ - var scroller = makeScrollHandler($('.viewer'), { + SCROLLER = makeScrollHandler($('.viewer'), { // XXX after click and initial move the screen jumps // (both x and y), margins, left vs. translate? // @@ -115,7 +120,9 @@ $(function(){ // it's either this or disable the jQuery animation... // ...have to benchmark to see which is better... - transitionDuration: 0, + // XXX BUG: if transition is set to non-0 then it initializes + // only after an action, e.g. a click... + transitionDuration: TRANSITION_MODE_DEFAULT == 'animate' ? 0 : SCROLLER_ANIMATE_DURATION, transitionEasing: 'liner', // keep selectable elements selectable... @@ -124,7 +131,6 @@ $(function(){ '.overlay-info, '+ '', }) - .start() $('.viewer') .on('shortClick', function(){ clickHandler(event) }) @@ -247,6 +253,8 @@ $(function(){ } updateImages() + + SCROLLER.start() }) }) diff --git a/ui/layout.css b/ui/layout.css index 0bf9719c..d7a46f2d 100644 --- a/ui/layout.css +++ b/ui/layout.css @@ -884,6 +884,7 @@ body { height: 100%; width: 100%; opacity: 0.7; + cursor: auto; } /************************************************************ Help ***/ /* XXX make this more generic, and not just for the keyboard... */ diff --git a/ui/layout.less b/ui/layout.less index cf426f96..5cfa0c6b 100755 --- a/ui/layout.less +++ b/ui/layout.less @@ -881,6 +881,8 @@ body { height: 100%; width: 100%; opacity: 0.7; + + cursor: auto; } diff --git a/ui/lib/jli.js b/ui/lib/jli.js index 9b954ace..67823941 100755 --- a/ui/lib/jli.js +++ b/ui/lib/jli.js @@ -648,6 +648,32 @@ Date.fromTimeStamp = function(ts){ } +function logCalls(func, logger){ + var that = this + var _func = function(){ + logger(func, arguments) + return func.apply(that, arguments) + } + _func.name = func.name + return _func +} + + +function assyncCall(func){ + var that = this + var _func = function(){ + var res = $.Deferred() + setTimeout(function(){ + res.resolve(func.apply(that, arguments)) + }, 0) + return res + } + _func.name = func.name + return _func +} + + + /********************************************************************** * vim:set ts=4 sw=4 : */ diff --git a/ui/lib/scroller.js b/ui/lib/scroller.js index 1ad5b84b..08c4e192 100755 --- a/ui/lib/scroller.js +++ b/ui/lib/scroller.js @@ -339,6 +339,10 @@ function makeScrollHandler(root, config){ .on('mouseup', endMoveHandler) } } + + // setup transitions... + this.resetTransitions() + return this }, // XXX test... @@ -366,6 +370,8 @@ function makeScrollHandler(root, config){ var scrolled = this.root.children().first() setTransitionDuration(scrolled, this.options.transitionDuration) setTransitionEasing(scrolled, this.options.transitionEasing) + + return this } } diff --git a/ui/modes.js b/ui/modes.js index c9ce6a2f..adcd4767 100755 --- a/ui/modes.js +++ b/ui/modes.js @@ -179,6 +179,9 @@ var toggleSlideShowMode = createCSSClassToggler( if(action == 'on'){ updateStatus('Slideshow...').show() + // XXX is this the correct way to go??? + $('.viewer').addClass('overlay') + // interval from user... // XXX make this a real UI... var interval = prompt('Slideshow interval (sec):', SLIDESHOW_INTERVAL/1000) @@ -187,12 +190,19 @@ var toggleSlideShowMode = createCSSClassToggler( if(interval == null){ showStatus('Slideshow: cencelled...') toggleSlideShowMode('off') + + // XXX is this the correct way to go??? + $('.viewer').removeClass('overlay') + return } SLIDESHOW_INTERVAL = isNaN(interval) ? 3000 : interval*1000 showStatus('Slideshow: starting', SLIDESHOW_LOOP ? 'looped...' : 'unlooped...') + + // XXX is this the correct way to go??? + $('.viewer').removeClass('overlay') toggleSingleImageMode('on') _slideshow_timer = setInterval(function(){