mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
refactoring, cleanup and tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
877740182b
commit
8ca86babb5
@ -2224,6 +2224,8 @@ var BaseBrowserPrototype = {
|
|||||||
// the .options attribute...
|
// the .options attribute...
|
||||||
//
|
//
|
||||||
// XXX use partial render for things like search....
|
// XXX use partial render for things like search....
|
||||||
|
// XXX make partial render be lazy -- i.e. add/remove elements and
|
||||||
|
// do not reconstruct the ones already present...
|
||||||
render: function(options, renderer, context){
|
render: function(options, renderer, context){
|
||||||
context = context || {}
|
context = context || {}
|
||||||
renderer = renderer || this
|
renderer = renderer || this
|
||||||
@ -2746,6 +2748,7 @@ object.makeConstructor('BaseBrowser',
|
|||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
// Get actual .item DOM element...
|
||||||
var getElem = function(elem){
|
var getElem = function(elem){
|
||||||
elem = elem.dom || elem
|
elem = elem.dom || elem
|
||||||
return elem.classList.contains('list') ?
|
return elem.classList.contains('list') ?
|
||||||
@ -2753,6 +2756,9 @@ var getElem = function(elem){
|
|||||||
: elem }
|
: elem }
|
||||||
|
|
||||||
|
|
||||||
|
// Make page navigation method...
|
||||||
|
//
|
||||||
|
// XXX this behaves in an odd way with .options.scrollBehavior = 'smooth'
|
||||||
var focusPage = function(direction){
|
var focusPage = function(direction){
|
||||||
var d = direction == 'up' ?
|
var d = direction == 'up' ?
|
||||||
'pagetop'
|
'pagetop'
|
||||||
@ -2772,6 +2778,45 @@ var focusPage = function(direction){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
var KEYBOARD_CONFIG =
|
||||||
|
module.KEYBOARD_CONFIG = {
|
||||||
|
// XXX
|
||||||
|
Filter: {
|
||||||
|
},
|
||||||
|
|
||||||
|
General: {
|
||||||
|
pattern: '*',
|
||||||
|
|
||||||
|
// XXX use up/down
|
||||||
|
Up: 'prev!',
|
||||||
|
Down: 'next!',
|
||||||
|
Left: 'left',
|
||||||
|
Right: 'right',
|
||||||
|
|
||||||
|
PgUp: 'pageUp!',
|
||||||
|
PgDown: 'pageDown!',
|
||||||
|
|
||||||
|
Home: 'focus: "first"',
|
||||||
|
End: 'focus: "last"',
|
||||||
|
|
||||||
|
|
||||||
|
Enter: 'open',
|
||||||
|
|
||||||
|
Space: 'toggleSelect',
|
||||||
|
ctrl_A: 'select!: "*"',
|
||||||
|
ctrl_D: 'deselect!: "*"',
|
||||||
|
ctrl_I: 'toggleSelect!: "*"',
|
||||||
|
|
||||||
|
// NOTE: do not bind this key, it is used to jump to buttons
|
||||||
|
// via tabindex...
|
||||||
|
Tab: 'NEXT',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
var BrowserClassPrototype = {
|
var BrowserClassPrototype = {
|
||||||
@ -2864,42 +2909,8 @@ var BrowserPrototype = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
// XXX STUB...
|
|
||||||
__keyboard_config: {
|
|
||||||
General: {
|
|
||||||
pattern: '*',
|
|
||||||
|
|
||||||
// XXX should pause on overflow...
|
__keyboard_config: KEYBOARD_CONFIG,
|
||||||
// XXX use up/down
|
|
||||||
Up: 'prev!',
|
|
||||||
Down: 'next!',
|
|
||||||
|
|
||||||
// XXX use left/right...
|
|
||||||
Left: 'left',
|
|
||||||
Right: 'right',
|
|
||||||
|
|
||||||
Home: 'focus: "first"',
|
|
||||||
End: 'focus: "last"',
|
|
||||||
|
|
||||||
// XXX screen navigation...
|
|
||||||
PgUp: 'pageUp!',
|
|
||||||
PgDown: 'pageDown!',
|
|
||||||
|
|
||||||
Enter: 'open',
|
|
||||||
|
|
||||||
Space: 'toggleSelect',
|
|
||||||
ctrl_A: 'select!: "*"',
|
|
||||||
ctrl_D: 'deselect!: "*"',
|
|
||||||
ctrl_I: 'toggleSelect!: "*"',
|
|
||||||
|
|
||||||
// NOTE: do not bind this key, it is used to jump to buttons
|
|
||||||
// via tabindex...
|
|
||||||
Tab: 'NEXT',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
|
|
||||||
//__keyboard_config: null,
|
|
||||||
get keybindings(){
|
get keybindings(){
|
||||||
return this.__keyboard_config },
|
return this.__keyboard_config },
|
||||||
|
|
||||||
@ -3398,7 +3409,7 @@ var BrowserPrototype = {
|
|||||||
|
|
||||||
// Custom events handlers...
|
// Custom events handlers...
|
||||||
//
|
//
|
||||||
// XXX keep element on screen if it's off or out of bounds....
|
// NOTE: element alignment is done via the browser focus mechanics...
|
||||||
__focus__: function(evt, elem){
|
__focus__: function(evt, elem){
|
||||||
var that = this
|
var that = this
|
||||||
elem
|
elem
|
||||||
@ -3500,7 +3511,7 @@ var BrowserPrototype = {
|
|||||||
.expand()
|
.expand()
|
||||||
: this.next() },
|
: this.next() },
|
||||||
|
|
||||||
// XXX should these focus the top/bottom element or and element at
|
// XXX should these focus the top/bottom element or an element at
|
||||||
// offset from top/bottom???
|
// offset from top/bottom???
|
||||||
pageUp: focusPage('up'),
|
pageUp: focusPage('up'),
|
||||||
pageDown: focusPage('down'),
|
pageDown: focusPage('down'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user