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... // do the actual work...
if(mode == 'animate'){ if(mode == 'animate'){
return ribbons.stop().animate(res, 100, 'linear') ribbons.stop().animate(res, 100, 'linear')
} else { } else {
return ribbons.css(res) ribbons.css(res)
} }
return image
} }
@ -492,6 +494,8 @@ function fitNImages(n){
// Marks... // 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') var toggleImageMark = createCSSClassToggler('.current.image', 'marked')
// mode can be: // mode can be:

View File

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