From a099d4a19953eb8d0fa92b2dd1f47cb6cb449ebb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 29 May 2022 11:20:51 +0200 Subject: fix OC-48 --- .../polyfrost/oneconfig/config/data/OptionSubcategory.java | 12 ++++++++---- .../java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'src/main/java/cc') diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java index cdd9c51..cf4e2f0 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java @@ -14,6 +14,8 @@ public class OptionSubcategory { public ArrayList options = new ArrayList<>(); public ArrayList topButtons = new ArrayList<>(); public ArrayList bottomButtons = new ArrayList<>(); + private ArrayList filteredOptions = new ArrayList<>(); + private int drawLastY; public OptionSubcategory(String name) { this.name = name; @@ -21,7 +23,7 @@ public class OptionSubcategory { public int draw(long vg, int x, int y) { String filter = OneConfigGui.INSTANCE == null ? "" : OneConfigGui.INSTANCE.getSearchValue().toLowerCase().trim(); - ArrayList filteredOptions = new ArrayList<>(options); + filteredOptions = new ArrayList<>(options); ArrayList filteredTop = new ArrayList<>(topButtons); ArrayList filteredBottom = new ArrayList<>(bottomButtons); if (!filter.equals("") && !name.toLowerCase().contains(filter)) { @@ -70,7 +72,7 @@ public class OptionSubcategory { optionY += 16; } - int drawLastY = optionY; + drawLastY = optionY; if (filteredOptions.size() > 0) { for (int i = 0; i < filteredOptions.size(); i++) { BasicOption option = filteredOptions.get(i); @@ -94,6 +96,10 @@ public class OptionSubcategory { optionY += page.getHeight() + 16; } + return optionY - y; + } + + public void drawLast(long vg, int x) { for (int i = 0; i < filteredOptions.size(); i++) { BasicOption option = filteredOptions.get(i); option.drawLast(vg, x, drawLastY); @@ -108,8 +114,6 @@ public class OptionSubcategory { } drawLastY += option.getHeight() + 16; } - - return optionY - y; } public String getName() { diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java index e3301bb..205de07 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java @@ -43,6 +43,9 @@ public class ModConfigPage extends Page { for (OptionSubcategory subCategory : page.categories.get(selectedCategory).subcategories) { optionY += subCategory.draw(vg, x + 30, optionY); } + for (OptionSubcategory subCategory : page.categories.get(selectedCategory).subcategories) { + subCategory.drawLast(vg, x + 30); + } totalSize = optionY - y; } -- cgit