tweaks...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-07 04:27:49 +04:00
parent f092e6641d
commit d61dbc0af0
5 changed files with 32 additions and 6 deletions

View File

@ -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)

View File

@ -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')

View File

@ -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(){

View File

@ -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:
* {
* <section-title>: {
@ -520,7 +528,6 @@ function buildKeybindingsHelp(keybindings, shifted_keys){
// Build a basic HTML table with keyboard help...
//
//
// The table will look like this:
//
// <table class="keyboard-help">
@ -576,6 +583,13 @@ function buildKeybindingsHelpHTML(keybindings){
/**********************************************************************
* Key binding editor...
*/
// XXX
/**********************************************************************
* vim:set ts=4 sw=4 : */

View File

@ -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