add tooltip

This commit is contained in:
Isse
2024-11-07 18:41:32 +01:00
parent 55d62513c6
commit 221a1618f2
2 changed files with 25 additions and 13 deletions

View File

@ -52,3 +52,5 @@ hud-crafting-repair_slot_title = Damaged Item
hud-crafting-repair_slot_desc = Place an item here to see the cost of repairing it at its current durability level.
hud-crafting-recipe-uncraftable = Recipe Cannot be Crafted
hud-crafting-recipe-unlearned = You must first learn how to craft this recipe.
hud-crafting-show_unknown_recipes = Show Unknown Recipes
hud-crafting-hide_unknown_recipes = Hide Unknown Recipes

View File

@ -2336,19 +2336,22 @@ impl<'a> Widget for Crafting<'a> {
.top_left_with_margins_on(state.ids.window, 52.0, 26.0)
.graphics_for(state.ids.btn_open_search)
.set(state.ids.input_overlay_search, ui);
let (eye, eye_hover, eye_press) = if self.settings.gameplay.show_all_recipes {
(
self.imgs.eye_open_btn,
self.imgs.eye_open_btn_hover,
self.imgs.eye_open_btn_press,
)
} else {
(
self.imgs.eye_closed_btn,
self.imgs.eye_closed_btn_hover,
self.imgs.eye_closed_btn_press,
)
};
let (eye, eye_hover, eye_press, tooltip_key) =
if self.settings.gameplay.show_all_recipes {
(
self.imgs.eye_open_btn,
self.imgs.eye_open_btn_hover,
self.imgs.eye_open_btn_press,
"hud-crafting-hide_unknown_recipes",
)
} else {
(
self.imgs.eye_closed_btn,
self.imgs.eye_closed_btn_hover,
self.imgs.eye_closed_btn_press,
"hud-crafting-show_unknown_recipes",
)
};
if Button::image(eye)
.top_left_with_margins_on(state.ids.align_rec, -21.0, 5.0)
@ -2356,6 +2359,13 @@ impl<'a> Widget for Crafting<'a> {
.hover_image(eye_hover)
.press_image(eye_press)
.parent(state.ids.window)
.with_tooltip(
self.tooltip_manager,
&self.localized_strings.get_msg(tooltip_key),
"",
&tabs_tooltip,
TEXT_COLOR,
)
.set(state.ids.btn_show_all_recipes, ui)
.was_clicked()
{