From 63c19e5365984fd0d4e040a5d81c8ed7503e2703 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 7 Jun 2013 01:36:49 +0400 Subject: [PATCH] experemental: added scroller.js (not yet working, and disabled)... Signed-off-by: Alex A. Naanou --- ui/base.js | 7 ++++--- ui/index.html | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/ui/base.js b/ui/base.js index 3d7a2218..af3d01c6 100755 --- a/ui/base.js +++ b/ui/base.js @@ -163,8 +163,6 @@ function getRibbonIndex(elem){ // NOTE: if used during an animation/transition this will give the // position at the exact frame of the animation, this might not be // the desired "final" data... -// XXX account for rotated images... -// need to keep this generic but still account for rotation... function getRelativeVisualPosition(outer, inner){ outer = $(outer).offset() inner = $(inner).offset() @@ -669,9 +667,12 @@ function clickHandler(evt){ } -// XXX for some reason this messes up alignment for the initial view... +// XXX this does not work correctly because it also generates two clicks, +// and this messes things up... function dblClickHandler(evt){ + //setTimeout(toggleSingleImageMode, 100) toggleSingleImageMode() + return false } diff --git a/ui/index.html b/ui/index.html index 2950ed69..d9b32aba 100755 --- a/ui/index.html +++ b/ui/index.html @@ -52,6 +52,7 @@ less = { + @@ -73,6 +74,8 @@ less = { //DEBUG = true +var SCROLLER_ENABLED = false + // setup... $(function(){ // defaults... @@ -83,12 +86,36 @@ $(function(){ autoHideCursor($('.viewer')) - // NOTE: this is global so as to not to add any extra complexity to - // the internal workings... - $('.viewer') - .click(clickHandler) - // XXX for some reason this messes up alignment on initial view... - //.dblclick(dblClickHandler) + // XXX still buggy... + if(SCROLLER_ENABLED){ + var scroller = makeScrollHandler($('.viewer'), { + //vScroll: false, + //hScroll: false, + scrollDisabled: true, + + //enableMultiClicks: true, + // XXX does not seem to work... + //multiClickTimeout: 100, + + transitionDuration: 100, + transitionEasing: 'liner', + }) + .start() + + $('.viewer') + .on('shortClick', function(){ clickHandler(event) }) + //.on('doubleClick', dblClickHandler) + .on('longClick', dblClickHandler) + //.on('longClick', function(){ toggleImageMark() }) + + } else { + // NOTE: this is global so as to not to add any extra complexity to + // the internal workings... + $('.viewer') + // XXX this messes things up... + //.dblclick(dblClickHandler) + .click(clickHandler) + } $(window) .resize(function() {