mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
(Yet another) fix for setFocusItemIndex() draw issues!
This commit is contained in:
parent
a7993281b9
commit
b7274a16d4
1 changed files with 10 additions and 8 deletions
|
@ -170,15 +170,11 @@ VerticalMenuView.prototype.setFocusItemIndex = function(index) {
|
||||||
top : this.focusedItemIndex,
|
top : this.focusedItemIndex,
|
||||||
bottom : Math.min(this.focusedItemIndex + this.maxVisibleItems, this.items.length) - 1
|
bottom : Math.min(this.focusedItemIndex + this.maxVisibleItems, this.items.length) - 1
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
this.viewWindow = {
|
this.positionCacheExpired = false; // skip standard behavior
|
||||||
top : 0,
|
this.performAutoScale();
|
||||||
bottom : Math.min(this.maxVisibleItems, this.items.length) - 1
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.positionCacheExpired = false; // skip standard behavior
|
|
||||||
this.performAutoScale();
|
|
||||||
this.redraw();
|
this.redraw();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -218,7 +214,7 @@ VerticalMenuView.prototype.focusNext = function() {
|
||||||
|
|
||||||
this.viewWindow = {
|
this.viewWindow = {
|
||||||
top : 0,
|
top : 0,
|
||||||
bottom : Math.min(this.focusedItemIndex + this.maxVisibleItems, this.items.length) - 1
|
bottom : Math.min(this.maxVisibleItems, this.items.length) - 1
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
this.focusedItemIndex++;
|
this.focusedItemIndex++;
|
||||||
|
@ -250,6 +246,12 @@ VerticalMenuView.prototype.focusPrevious = function() {
|
||||||
if(this.focusedItemIndex < this.viewWindow.top) {
|
if(this.focusedItemIndex < this.viewWindow.top) {
|
||||||
this.viewWindow.top--;
|
this.viewWindow.top--;
|
||||||
this.viewWindow.bottom--;
|
this.viewWindow.bottom--;
|
||||||
|
|
||||||
|
// adjust for focus index being set & window needing expansion as we scroll up
|
||||||
|
const rem = (this.viewWindow.bottom - this.viewWindow.top) + 1;
|
||||||
|
if(rem < this.maxVisibleItems && (this.items.length - 1) > this.focusedItemIndex) {
|
||||||
|
this.viewWindow.bottom = this.items.length - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue