forked from 0x2620/pandora
implement backtick / shift+backtick, which moves focus between: list folder / filters with selection or browser / list with selection or item with keyboard controls / additional clip list with selection (fixes #777)
This commit is contained in:
parent
c0e95624df
commit
6937956e96
1 changed files with 57 additions and 0 deletions
|
@ -340,6 +340,9 @@ pandora.ui.mainMenu = function() {
|
|||
var e = error;
|
||||
}
|
||||
},
|
||||
key_backtick: function() {
|
||||
changeFocus(1);
|
||||
},
|
||||
key_control_comma: function() {
|
||||
if (!pandora.hasDialogOrScreen()) {
|
||||
pandora.UI.set({page: 'preferences'});
|
||||
|
@ -390,6 +393,9 @@ pandora.ui.mainMenu = function() {
|
|||
key_shift_b: function() {
|
||||
ui.item && pandora.UI.set({showBrowser: !ui.showBrowser});
|
||||
},
|
||||
key_shift_backtick: function() {
|
||||
changeFocus(-1);
|
||||
},
|
||||
key_shift_f: function() {
|
||||
!ui.item && pandora.UI.set({showFilters: !ui.showFilters});
|
||||
},
|
||||
|
@ -494,6 +500,57 @@ pandora.ui.mainMenu = function() {
|
|||
}
|
||||
});
|
||||
|
||||
function changeFocus(direction) {
|
||||
var elements = [],
|
||||
index,
|
||||
listData = pandora.getListData();
|
||||
elements[0] = !listData.folder ? pandora.$ui.allItems
|
||||
: pandora.$ui.folderList[listData.folder];
|
||||
if (!ui.item && ui.showFilters) {
|
||||
pandora.$ui.filters.forEach(function($filter) {
|
||||
if ($filter.options('selected').length) {
|
||||
elements.push($filter);
|
||||
}
|
||||
});
|
||||
} else if (ui.item && ui.showBrowser) {
|
||||
elements.push(pandora.$ui.browser);
|
||||
}
|
||||
if (!ui.item) {
|
||||
if (['map', 'calendar'].indexOf(ui.listView) > -1) {
|
||||
elements.push(pandora.$ui[ui.listView]);
|
||||
if (pandora.$ui.clipList.options('selected').length) {
|
||||
elements.push(pandora.$ui.clipList);
|
||||
}
|
||||
} else if (pandora.$ui.list.options('selected').length) {
|
||||
elements.push(pandora.$ui.list);
|
||||
}
|
||||
} else {
|
||||
if (['player', 'editor', 'timeline', 'map', 'calendar'].indexOf(ui.itemView) > -1) {
|
||||
elements.push(pandora.$ui[ui.itemView]);
|
||||
}
|
||||
if (
|
||||
['clips', 'map', 'calendar'].indexOf(ui.itemView) > -1
|
||||
&& pandora.$ui.clipList.options('selected').length
|
||||
) {
|
||||
elements.push(pandora.$ui.clipList);
|
||||
}
|
||||
if (
|
||||
ui.itemView == 'data'
|
||||
&& pandora.$ui.item.options('selected').length
|
||||
) {
|
||||
elements.push(pandora.$ui.item);
|
||||
}
|
||||
}
|
||||
index = direction == 1 ? -1 : elements.length;
|
||||
Ox.forEach(elements, function(element, i) {
|
||||
if (element.hasFocus()) {
|
||||
index = i;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
elements[Ox.mod((index + direction), elements.length)].gainFocus();
|
||||
}
|
||||
|
||||
function getListMenu(lists) {
|
||||
return { id: 'listMenu', title: 'List', items: Ox.merge(
|
||||
{ id: 'allitems', title: 'All ' + pandora.site.itemName.plural, checked: !ui.item && !ui._list, keyboard: 'shift control w' },
|
||||
|
|
Loading…
Reference in a new issue