From 7bd18223b587e2957745d0088407d62a2a9b4f6d Mon Sep 17 00:00:00 2001 From: Wlowscha <54003515+Wlowscha@users.noreply.github.com> Date: Mon, 24 Feb 2025 00:51:43 +0100 Subject: [PATCH] Specific reset behavior for caught filter in starter select menu --- src/ui/starter-select-ui-handler.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ui/starter-select-ui-handler.ts b/src/ui/starter-select-ui-handler.ts index f6ecf150f9f..d0208db9569 100644 --- a/src/ui/starter-select-ui-handler.ts +++ b/src/ui/starter-select-ui-handler.ts @@ -1059,9 +1059,17 @@ export default class StarterSelectUiHandler extends MessageUiHandler { * Set the selections for all filters to their default starting value */ resetFilters() : void { + this.filterBar.setValsToDefault(); + this.resetCaughtDropdown(); + } + + /** + * Set default value for the caught dropdown, which only shows caught mons + */ + resetCaughtDropdown(): void { const caughtDropDown: DropDown = this.filterBar.getFilter(DropDownColumn.CAUGHT); - this.filterBar.setValsToDefault(); + caughtDropDown.resetToDefault(); // initial setting, in caught filter, select the options excluding the uncaught option for (let i = 0; i < caughtDropDown.options.length; i++) { @@ -1302,8 +1310,12 @@ export default class StarterSelectUiHandler extends MessageUiHandler { // CANCEL with a filter menu open > close it this.filterBar.toggleDropDown(this.filterBarCursor); success = true; - } else if (this.filterMode && !this.filterBar.getFilter(this.filterBarCursor).hasDefaultValues()) { - this.filterBar.resetSelection(this.filterBarCursor); + } else if (this.filterMode && !this.filterBar.getFilter(this.filterBar.getColumn(this.filterBarCursor)).hasDefaultValues()) { + if (this.filterBar.getColumn(this.filterBarCursor) === DropDownColumn.CAUGHT) { + this.resetCaughtDropdown(); + } else { + this.filterBar.resetSelection(this.filterBarCursor); + } this.updateStarters; success = true; } else if (this.statsMode) {