added keyboard shortcuts to toggle non-traversable and/or disabled elements...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-11-29 17:28:50 +03:00
parent b8ca5619bf
commit 8ead40ded1
2 changed files with 57 additions and 21 deletions

View File

@ -183,11 +183,26 @@ var BrowserPrototype = {
// setting.
// NOTE: another way to disable traversal is to set
// .not-traversable on the .browse-widget element
// NOTE: if false this will also disable .toggleNonTraversableDrawing()
// as this will essentially hide/show the whole list.
traversable: true,
showNonTraversable: true,
showDisabled: true,
// enable/disable disabled drawing...
//
// If false these will disable the corresponding methods.
//
// NOTE: these are here to let the user enable/disable these
// without the need to go into the keyboard configuration...
// NOTE: non-traversable drawing is disabled/enabled by .traversable
// option above.
// NOTE: this will have an effect only on items disabled via list/make
// items with .disabled CSS class set manually will not be
// affected...
toggleDisabledDrawing: true,
actionButton: false,
pushButton: false,
@ -239,6 +254,7 @@ var BrowserPrototype = {
'A',
'P',
'O',
'T', 'D',
// let the system handle copy paste...
'C', 'V', 'X',
@ -267,6 +283,7 @@ var BrowserPrototype = {
'A',
'P',
'O',
'T', 'D',
// let the system handle copy paste...
'C', 'V', 'X',
@ -301,9 +318,6 @@ var BrowserPrototype = {
Home: 'select!: "first"',
End: 'select!: "last"',
// XXX add page up and page down...
// XXX
Enter: 'action',
O: 'action',
Esc: 'close',
@ -314,6 +328,9 @@ var BrowserPrototype = {
ctrl: 'startFullPathEdit!',
},
D: 'toggleDisabledDrawing',
T: 'toggleNonTraversableDrawing',
// XXX should these be select???
// XXX should these be relative to visible area or absolute
// to current list regardless of scroll (as is now)???
@ -385,18 +402,6 @@ var BrowserPrototype = {
this.options.traversable = value
},
toogleTraversableDrawing: function(){
this.options.showNonTraversable = !this.options.showNonTraversable
this.update()
return this
},
toogleDisabledDrawing: function(){
this.options.showDisabled = !this.options.showDisabled
this.update()
return this
},
// Get/set the listed path...
//
// On more info on setting the path see .update(..)
@ -464,6 +469,37 @@ var BrowserPrototype = {
return this.select(value)
},
// NOTE: if .options.traversable is false this will have no effect.
// XXX might be a good idea to toggle .non-traversable-hidden CSS
// class here too...
// ...will need to account for 1-9 shortcut keys and hints to
// still work...
toggleNonTraversableDrawing: function(){
if(this.options.traversable == false){
return this
}
this.options.showNonTraversable = !this.options.showNonTraversable
this.update()
return this
},
// XXX this will not affect elements that were disabled via setting
// the .disabled class and not via list/make...
// ...is this a problem???
// XXX might be a good idea to toggle .disabled-hidden CSS class
// here too...
// ...will need to account for 1-9 shortcut keys and hints to
// still work...
toggleDisabledDrawing: function(){
if(this.options.toggleDisabledDrawing == false){
return this
}
this.options.showDisabled = !this.options.showDisabled
this.update()
return this
},
// Copy/Paste actions...
//
// XXX use 'Text' for IE...
@ -639,8 +675,8 @@ var BrowserPrototype = {
interactive = true
// do not draw non-traversable elements if .showNonTraversable
// is false...
// skip drawing of non-traversable or disabled elements if
// .showNonTraversable or .showDisabled are false respectively...
if((!traversable && !that.options.showNonTraversable)
|| (disabled && !that.options.showDisabled)){
return $()

View File

@ -3313,10 +3313,10 @@ module.FileSystemLoader = ImageGridFeatures.Feature({
//---------------------------------------------------------------------
var FileSystemLoaderUIActions = actions.Actions({
// NOTE: this is the same as .browsePath(..) if no argument is given.
// the difference is how the first (path/base) argument is handled
// here it's the path to load (now browser shown) and in
// .browsePath(..) it's the base path to start from.
// NOTE: if no path is passed (null) this behaves just like .browsePath(..)
// otherwise it will just load the given path (no UI) while
// .browsePath(..) will load the UI in all cases but will treat
// the given path as a base path to start from.
// XXX should passing no path to this start browsing from the current
// path or from the root?
loadPath: ['File/Load path...',