Fixed logic for cursor coming down from filter bar

This commit is contained in:
Wlowscha 2025-02-08 01:43:42 +01:00
parent 3d02a39436
commit 1024d5efaf
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -928,19 +928,15 @@ export default class PokedexUiHandler extends MessageUiHandler {
case Button.DOWN: case Button.DOWN:
if (this.filterBar.openDropDown) { if (this.filterBar.openDropDown) {
success = this.filterBar.incDropDownCursor(); success = this.filterBar.incDropDownCursor();
} else if (this.filterBarCursor === this.filterBar.numFilters - 1) {
// DOWN from the last filter
this.setFilterMode(false);
this.cursorObj.setVisible(false);
success = true;
} else if (numberOfStarters > 0) { } else if (numberOfStarters > 0) {
// DOWN from filter bar to top of Pokemon list // DOWN from filter bar to top of Pokemon list
this.setFilterMode(false); this.setFilterMode(false);
this.scrollCursor = 0; this.scrollCursor = 0;
this.updateScroll(); this.updateScroll();
const proportion = this.filterBarCursor / Math.max(1, this.filterBar.numFilters - 1); const proportion = this.filterBarCursor / Math.max(1, this.filterBar.numFilters - 1);
const targetCol = Math.min(8, Math.floor(proportion * 11)); const targetCol = Math.min(8, Math.floor(proportion * 8));
this.setCursor(Math.min(targetCol, numberOfStarters)); this.setCursor(Math.min(targetCol, numberOfStarters));
console.log(this.filterBar.numFilters, proportion, targetCol);
success = true; success = true;
} }
break; break;