cleaned-up marked-only mode...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-05-03 02:11:24 +04:00
parent 9f302223bb
commit 0605570b2d
2 changed files with 38 additions and 11 deletions

View File

@ -287,10 +287,12 @@ function centerImage(image, mode){
}
// do the actual work...
if(mode == 'animate'){
return ribbons.stop().animate(res, 100, 'linear')
ribbons.stop().animate(res, 100, 'linear')
} else {
return ribbons.css(res)
ribbons.css(res)
}
return image
}
@ -492,6 +494,8 @@ function fitNImages(n){
// Marks...
// XXX if this unmarks an image in marked-only mode no visible image is
// going to be current...
var toggleImageMark = createCSSClassToggler('.current.image', 'marked')
// mode can be:

View File

@ -6,15 +6,15 @@
//var DEBUG = DEBUG != null ? DEBUG : true
/*********************************************************************/
var STEPS_TO_CHANGE_DIRECTION = 2
var _STEPS_LEFT_TO_CHANGE_DIRECTION = STEPS_TO_CHANGE_DIRECTION
// XXX code related to this needs testing...
var DIRECTION = 'next'
/*********************************************************************/
var KEYBOARD_CONFIG = {
// general setup...
'.viewer': {
@ -96,6 +96,9 @@ var KEYBOARD_CONFIG = {
End: function(){
lastImage()
},
// combined navigation and editor actions...
Up: {
default: function(){ prevRibbon(DIRECTION) },
shift: function(){ shiftImageUp(null, DIRECTION) },
@ -106,7 +109,6 @@ var KEYBOARD_CONFIG = {
},
// zooming...
'1': function(){ fitNImages(1) },
'2': function(){ fitNImages(2) },
@ -118,6 +120,7 @@ var KEYBOARD_CONFIG = {
// XXX for some reason this also hooks the Backspace key (80)...
'8': function(){ fitNImages(8) },
'9': function(){ fitNImages(9) },
// XXX bind the +/- keys...
// XXX this is temporary, combine this with single image mode...
@ -128,6 +131,10 @@ var KEYBOARD_CONFIG = {
// marking...
// XXX not final, think of a better way to do this...
// XXX need mark navigation...
// XXX need marked image shift up/down actions...
// XXX unmarking an image in marked-only mode results in nothing
// visible focused if we unmark the first or last image in
// the ribbon...
M: {
// NOTE: marking moves in the same direction as the last
// move...
@ -136,6 +143,9 @@ var KEYBOARD_CONFIG = {
// NOTE: marking does not change move direction...
default: function(){
toggleImageMark()
if($('.current.image').filter(':visible').length == 0){
centerImage(focusImage(getImageBefore()), 'css')
}
if(DIRECTION == 'next'){
nextImage()
} else {
@ -145,13 +155,30 @@ var KEYBOARD_CONFIG = {
// same as default but in reverse direction...
shift: function(){
toggleImageMark()
if($('.current.image').filter(':visible').length == 0){
centerImage(focusImage(getImageBefore()), 'css')
}
if(DIRECTION == 'prev'){
nextImage()
} else {
prevImage()
}
},
ctrl: function(){ toggleImageMark() },
ctrl: function(){
var action = toggleImageMark()
// focus an image instead of the one that just vanished...
if(action == 'off' && toggleMarkedOnlyView('?') == 'on'){
if(DIRECTION == 'next'){
nextImage()
} else {
prevImage()
}
if($('.current.image').filter(':visible').length == 0){
centerImage(focusImage(getImageBefore()))
}
}
},
},
I: {
ctrl: function(){ invertImageMarks() },
@ -170,9 +197,5 @@ var KEYBOARD_CONFIG = {
/**********************************************************************
* vim:set ts=4 sw=4 : */