Finally fix setFocusItemIndex() draw issues!
This commit is contained in:
parent
9155832139
commit
43c5de3e40
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue