Skip to content

Commit

Permalink
fix: Prevent right clicking helper button in guides clearing input [s…
Browse files Browse the repository at this point in the history
…kip ci] (#2372)

* fix: Prevent right clicking helper button in guides clearing input

* fix: Fix some formatting on item filter tooltip

* chore: Move info texture to icons directory
  • Loading branch information
JamieCallan117 committed Mar 15, 2024
1 parent ac9998e commit 4b5e602
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright © Wynntils 2023.
* Copyright © Wynntils 2023-2024.
* This file is released under LGPLv3. See LICENSE for full license details.
*/
package com.wynntils.screens.guides;
Expand All @@ -16,6 +16,8 @@
import net.minecraft.network.chat.Component;

public abstract class WynntilsGuideScreen<E, B extends WynntilsButton> extends WynntilsListScreen<E, B> {
private WynntilsButton helperButton;

protected WynntilsGuideScreen(Component component) {
super(component);

Expand All @@ -28,7 +30,7 @@ protected WynntilsGuideScreen(Component component) {
protected void doInit() {
super.doInit();

WynntilsButton helperButton = new ItemSearchHelperWidget(
helperButton = new ItemSearchHelperWidget(
Texture.CONTENT_BOOK_BACKGROUND.width() - 17,
-19,
(int) (Texture.INFO.width() / 1.7f),
Expand Down Expand Up @@ -73,5 +75,18 @@ protected final void reloadElementsList(String ignored) {
reloadElementsList(itemSearchWidget.getSearchQuery());
}

@Override
public boolean doMouseClicked(double mouseX, double mouseY, int button) {
final float translationX = getTranslationX();
final float translationY = getTranslationY();

// Don't want right click clearing the text input
if (helperButton != null && helperButton.mouseClicked(mouseX - translationX, mouseY - translationY, button)) {
return false;
}

return super.doMouseClicked(mouseX, mouseY, button);
}

protected abstract void reloadElementsList(ItemSearchQuery searchQuery);
}
Expand Up @@ -77,7 +77,7 @@ public enum Texture {
EDIT_ICON("icons/generic/edit_icon.png", 6, 16),
FAVORITE_ICON("icons/generic/favorite_icon.png", 18, 18),
HELP_ICON("icons/generic/help_icon.png", 10, 16),
INFO("info.png", 25, 25),
INFO("icons/generic/info.png", 25, 25),
ITEM_LOCK("icons/generic/item_lock_icon.png", 16, 16),
OVERLAY_EXTRA_ICON("icons/generic/overlay_extra_icon.png", 16, 16),
QUESTS_SCROLL_ICON("icons/generic/quests_scroll_icon.png", 16, 16),
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/resources/assets/wynntils/lang/en_us.json
Expand Up @@ -2146,7 +2146,7 @@
"service.wynntils.itemFilter.filter.anyString.usage": "\"profession: *\" would match any item with a profession stat",
"service.wynntils.itemFilter.filter.percentage.description": "Filters whether a StatValue's percentage value is in the filter range",
"service.wynntils.itemFilter.filter.percentage.name": "Percentage (StatValue)",
"service.wynntils.itemFilter.filter.percentage.usage": "Specify a single number (\"5%\"), or a range (\"5-10%\" or \">=13%\" or \"<25%\")",
"service.wynntils.itemFilter.filter.percentage.usage": "Specify a single number (\"5%%\"), or a range (\"5-10%%\" or \">=13%%\" or \"<25%%\")",
"service.wynntils.itemFilter.filter.rangedCappedValue.description": "Filters whether a CappedValue's current value is in the filter range",
"service.wynntils.itemFilter.filter.rangedCappedValue.name": "Ranged (CappedValue)",
"service.wynntils.itemFilter.filter.rangedCappedValue.usage": "Specify a single number (\"5\"), or a range (\"5-10\" or \">=13\" or \"<25\")",
Expand All @@ -2158,7 +2158,7 @@
"service.wynntils.itemFilter.filter.rangedStatValue.usage": "Specify a single number (\"5\"), or a range (\"5-1-10\" or \">=13\" or \"<25\")",
"service.wynntils.itemFilter.filter.string.description": "Filters whether a string matches the filter string",
"service.wynntils.itemFilter.filter.string.name": "String",
"service.wynntils.itemFilter.filter.string.usage": "\"profession: wood\" would match both woodcutting and woodworking. Using \"\" enables strict matching.",
"service.wynntils.itemFilter.filter.string.usage": "\"profession:wood\" would match both woodcutting and woodworking. Using \"\" enables strict matching.",
"service.wynntils.itemFilter.invalidFilter": "%s: invalid filter for type: %s",
"service.wynntils.itemFilter.sortingNotSupported": "Sorting is not supported for this container",
"service.wynntils.itemFilter.stat.actual.description": "%s stat of the item",
Expand Down

0 comments on commit 4b5e602

Please sign in to comment.