mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-02 04:10:11 +00:00
added direction awareness to shifting images up/down + several tweeks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
346b09b4c0
commit
1975f01dce
@ -433,16 +433,19 @@ function nextRibbon(moving, mode){
|
|||||||
|
|
||||||
|
|
||||||
// XXX get move direction...
|
// XXX get move direction...
|
||||||
function _shiftImageTo(image, direction, moving, force_create_ribbon){
|
function _shiftImageTo(image, direction, moving, force_create_ribbon, mode){
|
||||||
if(image == null){
|
if(image == null){
|
||||||
image = $('.current.image')
|
image = $('.current.image')
|
||||||
}
|
}
|
||||||
|
if(mode == null){
|
||||||
|
mode = NAV_DEFAULT
|
||||||
|
}
|
||||||
|
|
||||||
// account move for direction...
|
// account move for direction...
|
||||||
// XXX get the value from some place more logical than the argument...
|
// XXX get the value from some place more logical than the argument...
|
||||||
var a = moving == 'prev' ? 'prev' : 'next'
|
var a = moving == 'prev' ? 'prevAll' : 'nextAll'
|
||||||
var b = moving == 'prev' ? 'next' : 'prev'
|
var b = moving == 'prev' ? 'nextAll' : 'prevAll'
|
||||||
var target = image[a]('.image')
|
var target = image[a]('.image' + mode).first()
|
||||||
|
|
||||||
target = target.length == 0 ? image[b]() : target
|
target = target.length == 0 ? image[b]() : target
|
||||||
|
|
||||||
@ -453,17 +456,17 @@ function _shiftImageTo(image, direction, moving, force_create_ribbon){
|
|||||||
// XXX does this need to be animated???
|
// XXX does this need to be animated???
|
||||||
return centerImage(focusImage(target), 'css')
|
return centerImage(focusImage(target), 'css')
|
||||||
}
|
}
|
||||||
function shiftImageUp(image){
|
function shiftImageUp(image, moving){
|
||||||
return _shiftImageTo(image, 'prev')
|
return _shiftImageTo(image, 'prev', moving)
|
||||||
}
|
}
|
||||||
function shiftImageDown(image){
|
function shiftImageDown(image, moving){
|
||||||
return _shiftImageTo(image, 'next')
|
return _shiftImageTo(image, 'next')
|
||||||
}
|
}
|
||||||
function shiftImageUpNewRibbon(image){
|
function shiftImageUpNewRibbon(image, moving){
|
||||||
return _shiftImageTo(image, 'prev', true)
|
return _shiftImageTo(image, 'prev', moving, true)
|
||||||
}
|
}
|
||||||
function shiftImageDownNewRibbon(image){
|
function shiftImageDownNewRibbon(image, moving){
|
||||||
return _shiftImageTo(image, 'prev', false)
|
return _shiftImageTo(image, 'prev', moving, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -215,11 +215,11 @@ var KEYBOARD_CONFIG = {
|
|||||||
'.viewer': {
|
'.viewer': {
|
||||||
Up: {
|
Up: {
|
||||||
default: function(){ prevRibbon(DIRECTION) },
|
default: function(){ prevRibbon(DIRECTION) },
|
||||||
shift: function(){ shiftImageUp() },
|
shift: function(){ shiftImageUp(null, DIRECTION) },
|
||||||
},
|
},
|
||||||
Down: {
|
Down: {
|
||||||
default: function(){ nextRibbon(DIRECTION) },
|
default: function(){ nextRibbon(DIRECTION) },
|
||||||
shift: function(){ shiftImageDown() },
|
shift: function(){ shiftImageDown(null, DIRECTION) },
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX need to cancel the animation of the prev action...
|
// XXX need to cancel the animation of the prev action...
|
||||||
@ -285,6 +285,14 @@ var KEYBOARD_CONFIG = {
|
|||||||
default: 'Right',
|
default: 'Right',
|
||||||
shift: 'Left',
|
shift: 'Left',
|
||||||
},
|
},
|
||||||
|
/* XXX for some reason this does not work,,,
|
||||||
|
// XXX for some odd reason, returning false does not cancel
|
||||||
|
// default behaviour here...
|
||||||
|
Backspace: {
|
||||||
|
default: 'Left',
|
||||||
|
shift: 'Right',
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
Home: function(){
|
Home: function(){
|
||||||
firstImage()
|
firstImage()
|
||||||
@ -301,16 +309,20 @@ var KEYBOARD_CONFIG = {
|
|||||||
'5': function(){ fitNImages(5) },
|
'5': function(){ fitNImages(5) },
|
||||||
'6': function(){ fitNImages(6) },
|
'6': function(){ fitNImages(6) },
|
||||||
'7': function(){ fitNImages(7) },
|
'7': function(){ fitNImages(7) },
|
||||||
|
// 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 this is temporary, combine this with single image mode...
|
// XXX this is temporary, combine this with single image mode...
|
||||||
F: function(){ toggleImageProportions() },
|
F: function(){ toggleImageProportions() },
|
||||||
|
|
||||||
|
|
||||||
|
// marking...
|
||||||
// XXX not final, think of a better way to do this...
|
// XXX not final, think of a better way to do this...
|
||||||
I: {
|
I: {
|
||||||
shift: function(){ invertImageMarks() },
|
shift: function(){ invertImageMarks() },
|
||||||
},
|
},
|
||||||
A: {
|
A: {
|
||||||
shift: function(){ toggleImageMarkBlock() },
|
shift: function(){ toggleImageMarkBlock() },
|
||||||
ctrl: function(){ markAll('ribbon') },
|
ctrl: function(){ markAll('ribbon') },
|
||||||
@ -319,7 +331,6 @@ var KEYBOARD_CONFIG = {
|
|||||||
default: function(){ toggleImageMark() },
|
default: function(){ toggleImageMark() },
|
||||||
shift: function(){ toggleMarkedOnlyView() },
|
shift: function(){ toggleMarkedOnlyView() },
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user