added keyboard moving of view, oddly behaves non-linerely...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-08-02 17:54:40 +04:00
parent 1190646c7a
commit 49a8792e28
3 changed files with 70 additions and 12 deletions

View File

@ -14,8 +14,7 @@ Control scheme:
| action | action
| keyboard gesture button (tablet) button (desktop) | keyboard gesture button (tablet) button (desktop)
tablet / phone / desktop tablet / phone / desktop
single general
ribbon
focus image focus image
-- tap/click - - -- tap/click - -
left image left image
@ -23,13 +22,13 @@ Control scheme:
right image right image
right swipe left + - right swipe left + -
up image up image
up -- (via focus image) - - up -- (via focus image) ?? -
down image down image
down -- (via focus image) - - down -- (via focus image) ?? -
first image first image
home -- - - home -- ?? -
last image last image
end -- - - end -- ?? -
shift up shift up
s-up swipe up + - s-up swipe up + -
@ -41,7 +40,16 @@ Control scheme:
c-s-down ?? ?? ?? c-s-down ?? ?? ??
drag view drag view
?? tap-drag - - -- tap-drag - -
move view left
?? ?? ?? ??
move view right
?? ?? ?? ??
move view up
?? ?? ?? ??
move view down
?? ?? ?? ??
center current image center current image
?? ?? ?? ?? ?? ?? ?? ??
@ -51,15 +59,20 @@ Control scheme:
- pinch closeup - - - pinch closeup - -
fit one fit one
1 tap current image - - 1 tap current image - -
fit three
3 ?? - -
broad view
?? ?? - -
toggle single image mode toggle single image mode
?? ?? - - ?? ?? - -
toggle slideshow mode toggle slideshow mode
?? ?? - - ?? ?? - -
keyboard help
settings
ribbon-specific
fit three
3 ?? - -
broad view
?? ?? - -
single-specific
. .
| vim:set spell : | vim:set spell :

View File

@ -118,9 +118,10 @@ var keys = {
zoomIn: [187], zoomIn: [187],
zoomOut: [189], zoomOut: [189],
// zoom presets... // zoom presets...
zoomOriginal: [48],
fitOne: [49], fitOne: [49],
fitThree: [51], fitThree: [51],
// XXX is this relivant?
zoomOriginal: [48],
first: [36], first: [36],
last: [35], last: [35],
@ -133,6 +134,12 @@ var keys = {
promote: [45], promote: [45],
demote: [46], demote: [46],
moveViewUp: [75], // k
moveViewDown: [74], // j
moveViewLeft: [72], // h
moveViewRight: [76], // l
// keys to be ignored...
ignore: [16, 17, 18], ignore: [16, 17, 18],
helpShowOnUnknownKey: true helpShowOnUnknownKey: true
@ -186,6 +193,12 @@ function handleKeys(event){
: (fn(code, keys.fitOne) >= 0) ? fitImage() : (fn(code, keys.fitOne) >= 0) ? fitImage()
: (fn(code, keys.fitThree) >= 0) ? fitThreeImages() : (fn(code, keys.fitThree) >= 0) ? fitThreeImages()
// moving view...
: (fn(code, keys.moveViewUp) >= 0) ? moveViewUp()
: (fn(code, keys.moveViewDown) >= 0) ? moveViewDown()
: (fn(code, keys.moveViewLeft) >= 0) ? moveViewLeft()
: (fn(code, keys.moveViewRight) >= 0) ? moveViewRight()
: (fn(code, keys.toggleRibbonView) >= 0) ? toggleRibbonView() : (fn(code, keys.toggleRibbonView) >= 0) ? toggleRibbonView()
: (fn(code, keys.ignore) >= 0) ? false : (fn(code, keys.ignore) >= 0) ? false
// XXX // XXX
@ -247,6 +260,30 @@ function toggleWideView(){
/********************************************************* Movement **/
var MOVE_DELTA = 50
// XXX for some odd reason these are not liner... something to do with origin?
function moveViewUp(){
var t = parseInt($('.field').css('top'))
$('.field').css({'top': t-(MOVE_DELTA)})
}
function moveViewDown(){
var t = parseInt($('.field').css('top'))
$('.field').css({'top': t+(MOVE_DELTA)})
}
function moveViewLeft(){
var l = parseInt($('.field').css('left'))
$('.field').css({'left': l-(MOVE_DELTA)})
}
function moveViewRight(){
var l = parseInt($('.field').css('left'))
$('.field').css({'left': l+(MOVE_DELTA)})
}
/******************************************************* Navigation **/ /******************************************************* Navigation **/
// basic navigation... // basic navigation...
@ -263,6 +300,7 @@ function lastImage(){
$('.current.ribbon').children('.image').last().click() $('.current.ribbon').children('.image').last().click()
} }
// XXX for the above two functions to be stable we will need to jump up // XXX for the above two functions to be stable we will need to jump up
// to the next and down to the prev element... // to the next and down to the prev element...
function focusRibbon(direction){ function focusRibbon(direction){

View File

@ -103,6 +103,13 @@ $(document).ready(setup);
<button onclick="nextImage()">next (right)</button> <button onclick="nextImage()">next (right)</button>
<button onclick="lastImage()">last (end)</button> <button onclick="lastImage()">last (end)</button>
<br><br>
<button onclick="moveViewLeft()">left</button>
<button onclick="moveViewUp()">Up</button>
<button onclick="moveViewDown()">Down</button>
<button onclick="moveViewRight()">right</button>
<!--br><br> <!--br><br>
LEGACY: LEGACY:
<button onclick="showSingle()">single</button> <button onclick="showSingle()">single</button>