mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-22 10:45:56 +02:00
+ ToggleMenuView
* Start of hotkeys for menus * General menu cleanup & rework
This commit is contained in:
parent
10d8812300
commit
028c5be418
10 changed files with 172 additions and 9 deletions
|
@ -16,7 +16,7 @@ function VerticalMenuView(options) {
|
|||
|
||||
var self = this;
|
||||
|
||||
this.itemSpacing = 3;
|
||||
this.itemSpacing = 3; // :TODO: bring from options/configurable
|
||||
|
||||
this.calculateDimens = function() {
|
||||
if(!self.dimens || !self.dimens.width) {
|
||||
|
@ -54,6 +54,19 @@ function VerticalMenuView(options) {
|
|||
}
|
||||
};
|
||||
|
||||
this.changeSelection = function(fromIndex, toIndex) {
|
||||
assert(!self.positionCacheExpired);
|
||||
assert(fromIndex >= 0 && fromIndex <= self.items.length);
|
||||
assert(toIndex >= 0 && toIndex <= self.items.length);
|
||||
|
||||
self.items[fromIndex].focused = false;
|
||||
self.drawItem(fromIndex);
|
||||
|
||||
self.items[toIndex].focused = true;
|
||||
self.focusedItemIndex = toIndex;
|
||||
self.drawItem(toIndex);
|
||||
};
|
||||
|
||||
this.drawItem = function(index) {
|
||||
assert(!this.positionCacheExpired);
|
||||
|
||||
|
@ -91,6 +104,7 @@ VerticalMenuView.prototype.setFocus = function(focused) {
|
|||
this.redraw();
|
||||
};
|
||||
|
||||
|
||||
VerticalMenuView.prototype.onSpecialKeyPress = function(keyName) {
|
||||
|
||||
var prevFocusedItemIndex = this.focusedItemIndex;
|
||||
|
@ -110,7 +124,7 @@ VerticalMenuView.prototype.onSpecialKeyPress = function(keyName) {
|
|||
}
|
||||
|
||||
if(prevFocusedItemIndex !== this.focusedItemIndex) {
|
||||
this.moveSelection(prevFocusedItemIndex, this.focusedItemIndex);
|
||||
this.changeSelection(prevFocusedItemIndex, this.focusedItemIndex);
|
||||
}
|
||||
|
||||
VerticalMenuView.super_.prototype.onSpecialKeyPress.call(this, keyName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue