Finally fix setFocusItemIndex() draw issues!

This commit is contained in:
Bryan Ashby 2016-07-13 22:46:14 -06:00
parent 9155832139
commit 43c5de3e40
1 changed files with 13 additions and 9 deletions

View File

@ -164,17 +164,21 @@ VerticalMenuView.prototype.setFocus = function(focused) {
VerticalMenuView.prototype.setFocusItemIndex = function(index) { VerticalMenuView.prototype.setFocusItemIndex = function(index) {
VerticalMenuView.super_.prototype.setFocusItemIndex.call(this, index); // sets this.focusedItemIndex VerticalMenuView.super_.prototype.setFocusItemIndex.call(this, index); // sets this.focusedItemIndex
//this.updateViewVisibleItems(); const remainAfterFocus = this.items.length - index;
if(remainAfterFocus >= this.maxVisibleItems) {
// :TODO: |viewWindow| must be updated to reflect position change -- this.viewWindow = {
// if > visibile then += by diff, if < visible top : this.focusedItemIndex,
bottom : Math.min(this.focusedItemIndex + this.maxVisibleItems, this.items.length) - 1
if(this.focusedItemIndex > this.viewWindow.bottom) { };
} else if (this.focusedItemIndex < this.viewWindow.top) { } else {
// this.viewWindow.top--; this.viewWindow = {
// this.viewWindow.bottom--; top : 0,
bottom : Math.min(this.maxVisibleItems, this.items.length) - 1
};
} }
this.positionCacheExpired = false; // skip standard behavior
this.performAutoScale();
this.redraw(); this.redraw();
}; };