From d61dbc0af067048cb9148f9b0801cfb187be0715 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 7 Jun 2013 04:27:49 +0400 Subject: [PATCH] tweaks... Signed-off-by: Alex A. Naanou --- ui/base.js | 2 ++ ui/index.html | 12 ++++++++++-- ui/lib/jli.js | 2 +- ui/lib/keyboard.js | 18 ++++++++++++++++-- ui/lib/scroller.js | 4 +++- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ui/base.js b/ui/base.js index af3d01c6..456aa1a2 100755 --- a/ui/base.js +++ b/ui/base.js @@ -527,6 +527,7 @@ function alignVia(container, elem, via, valign, halign, mode){ // XXX make this more configurable (centering, ...)... +// XXX do a version using setElementTransform(...) function centerView(image, mode){ mode = mode == null ? TRANSITION_MODE_DEFAULT : mode @@ -589,6 +590,7 @@ function centerView(image, mode){ // // XXX this does not work in marked-only mode... // XXX this needs the image to exist... should be GID compatible... (???) +// XXX do a version using setElementTransform(...) function centerRibbon(ribbon, image, mode){ mode = mode == null ? TRANSITION_MODE_DEFAULT : mode ribbon = ribbon == null ? getRibbon() : $(ribbon) diff --git a/ui/index.html b/ui/index.html index 46bea612..814b7697 100755 --- a/ui/index.html +++ b/ui/index.html @@ -86,15 +86,23 @@ $(function(){ autoHideCursor($('.viewer')) - // XXX still buggy... if(SCROLLER_ENABLED){ var scroller = makeScrollHandler($('.viewer'), { + // XXX after click and initial move the screen jumps + // (both x and y), margins, left vs. translate? + // + // the problem is in centerView(...), seems scroller.js + // seems to not know where the element is after it does + // it's job, so the jump is scroller resetting the + // position... scrollDisabled: true, //enableMultiClicks: true, // XXX does not seem to work... //multiClickTimeout: 100, + // it's either this or disable the jQuery animation... + // ...have to benchmark to see which is better... transitionDuration: 0, transitionEasing: 'liner', }) @@ -102,9 +110,9 @@ $(function(){ $('.viewer') .on('shortClick', function(){ clickHandler(event) }) + // XXX for some reason this is broken... //.on('doubleClick', dblClickHandler) .on('longClick', dblClickHandler) - //.on('longClick', function(){ toggleImageMark() }) .on('swipeLeft', function(){ updateDirection('prev') diff --git a/ui/lib/jli.js b/ui/lib/jli.js index 1d9956b9..9b954ace 100755 --- a/ui/lib/jli.js +++ b/ui/lib/jli.js @@ -536,6 +536,7 @@ function setTransitionEasing(elem, ease){ }) } + function setTransitionDuration(elem, ms){ if(typeof(ms) == typeof(0)){ ms = ms + 'ms' @@ -551,7 +552,6 @@ function setTransitionDuration(elem, ms){ - /************************************************ jQuery extensions **/ jQuery.fn.reverseChildren = function(){ diff --git a/ui/lib/keyboard.js b/ui/lib/keyboard.js index d7b55562..4eb0fcf0 100755 --- a/ui/lib/keyboard.js +++ b/ui/lib/keyboard.js @@ -62,6 +62,7 @@ var _SPECIAL_KEYS = { 188: ',', 190: '.', 191: '/', } + var _SHIFT_KEYS = { '`': '~', '-': '_', '=':'+', @@ -73,6 +74,8 @@ var _SHIFT_KEYS = { ',': '<', '.': '>', '/': '?' } + +// build a reverse map of _SPECIAL_KEYS var _KEY_CODES = {} for(var k in _SPECIAL_KEYS){ _KEY_CODES[_SPECIAL_KEYS[k]] = k @@ -95,6 +98,7 @@ function toKeyName(code){ return null } + function toKeyCode(c){ if(c in _KEY_CODES){ return _KEY_CODES[c] @@ -102,6 +106,7 @@ function toKeyCode(c){ return c.charCodeAt(0) } + // documentation wrapper... function doc(text, func){ func = func == null ? function(){return true}: func @@ -147,8 +152,10 @@ function doc(text, func){ * NOTE: if a key is not handled in a mode, that mode will not be * present in the resulting object. * NOTE: this will not unwrap lisp-style (see below) handlers. + * NOTE: modes are prioritized by order of occurrence. * - * XXX need an explicit way to prioritize modes... + * XXX need an explicit way to prioritize modes, avoiding object attr + * ordering... * XXX check do we need did_handling here... * * XXX BUG explicitly given modes do not yield results if the pattern @@ -425,6 +432,7 @@ function makeKeyboardHandler(keybindings, unhandled){ /* Build structure ready for conversion to HTML help. +* * Structure: * { * : { @@ -520,7 +528,6 @@ function buildKeybindingsHelp(keybindings, shifted_keys){ // Build a basic HTML table with keyboard help... // -// // The table will look like this: // // @@ -576,6 +583,13 @@ function buildKeybindingsHelpHTML(keybindings){ +/********************************************************************** +* Key binding editor... +*/ + +// XXX + + /********************************************************************** * vim:set ts=4 sw=4 : */ diff --git a/ui/lib/scroller.js b/ui/lib/scroller.js index 371b49e2..1ad5b84b 100755 --- a/ui/lib/scroller.js +++ b/ui/lib/scroller.js @@ -2,6 +2,7 @@ * * General Swipe/Scroll handler lib * +* TODO a demo page to show/test the features... * **********************************************************************/ @@ -113,7 +114,8 @@ function makeScrollHandler(root, config){ } } */ - scrolled = $(root.children()[0]) + //scrolled = $(root.children()[0]) + scrolled = root.children().first() setTransitionDuration(scrolled, 0) // XXX these two are redundant... scrolling = true