Add seperate button for resetting search
This commit is contained in:
parent
dba69b1f71
commit
2a516ac22b
@ -14,9 +14,10 @@ Unified inventory code is licensed under the GNU LGPLv2+.
|
|||||||
Licenses for textures:
|
Licenses for textures:
|
||||||
|
|
||||||
VanessaE: (WTFPL)
|
VanessaE: (WTFPL)
|
||||||
* ui\_group.png
|
* `ui_group.png`
|
||||||
|
|
||||||
RealBadAngel: (WTFPL)
|
RealBadAngel: (WTFPL)
|
||||||
* Everything else.
|
* Everything else.
|
||||||
|
|
||||||
|
Tango Project: (WTFPL)
|
||||||
|
* `ui_reset_icon.png
|
||||||
|
@ -153,11 +153,17 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
|
|
||||||
if fields.searchbutton then
|
if fields.searchbutton then
|
||||||
unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange")
|
unified_inventory.apply_filter(player, unified_inventory.current_searchbox[player_name], "nochange")
|
||||||
unified_inventory.current_searchbox[player_name] = ""
|
|
||||||
unified_inventory.set_inventory_formspec(player,
|
unified_inventory.set_inventory_formspec(player,
|
||||||
unified_inventory.current_page[player_name])
|
unified_inventory.current_page[player_name])
|
||||||
minetest.sound_play("paperflip2",
|
minetest.sound_play("paperflip2",
|
||||||
{to_player=player_name, gain = 1.0})
|
{to_player=player_name, gain = 1.0})
|
||||||
|
elseif fields.searchresetbutton then
|
||||||
|
unified_inventory.apply_filter(player, "", "nochange")
|
||||||
|
unified_inventory.current_searchbox[player_name] = ""
|
||||||
|
unified_inventory.set_inventory_formspec(player,
|
||||||
|
unified_inventory.current_page[player_name])
|
||||||
|
minetest.sound_play("click",
|
||||||
|
{to_player=player_name, gain = 0.1})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- alternate buttons
|
-- alternate buttons
|
||||||
|
@ -179,13 +179,19 @@ function unified_inventory.get_formspec(player, page)
|
|||||||
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
|
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
|
||||||
formspec[n+1] = "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]"
|
formspec[n+1] = "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]"
|
||||||
.. "tooltip[searchbutton;" ..F("Search") .. "]"
|
.. "tooltip[searchbutton;" ..F("Search") .. "]"
|
||||||
|
formspec[n+2] = "image_button[12.9,8.1;.8,.8;ui_reset_icon.png;searchresetbutton;]"
|
||||||
|
.. "tooltip[searchbutton;" ..F("Search") .. "]"
|
||||||
|
.. "tooltip[searchresetbutton;" ..F("Reset search and display everything") .. "]"
|
||||||
else
|
else
|
||||||
formspec[n] = "field[8.5,5.225;2.2,1;searchbox;;"
|
formspec[n] = "field[8.5,5.225;2.2,1;searchbox;;"
|
||||||
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
|
.. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]"
|
||||||
formspec[n+1] = "image_button[10.3,5;.8,.8;ui_search_icon.png;searchbutton;]"
|
formspec[n+1] = "image_button[10.3,5;.8,.8;ui_search_icon.png;searchbutton;]"
|
||||||
.. "tooltip[searchbutton;" ..F("Search") .. "]"
|
.. "tooltip[searchbutton;" ..F("Search") .. "]"
|
||||||
|
formspec[n+2] = "image_button[11,5;.8,.8;ui_reset_icon.png;searchresetbutton;]"
|
||||||
|
.. "tooltip[searchbutton;" ..F("Search") .. "]"
|
||||||
|
.. "tooltip[searchresetbutton;" ..F("Reset search and display everything") .. "]"
|
||||||
end
|
end
|
||||||
n = n+2
|
n = n+3
|
||||||
|
|
||||||
local no_matches = "No matching items"
|
local no_matches = "No matching items"
|
||||||
if draw_lite_mode then
|
if draw_lite_mode then
|
||||||
|
BIN
textures/ui_reset_icon.png
Normal file
BIN
textures/ui_reset_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue
Block a user