1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

MainMenu: Add clear button and icon for search input (#10363)

This commit is contained in:
Andrey 2020-12-20 00:00:20 +03:00 committed by GitHub
parent ccbf8029ea
commit 5066fe7583
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 3 deletions

View file

@ -340,7 +340,6 @@ function store.get_formspec(dlgdata)
local W = 15.75
local H = 9.5
local formspec
if #store.packages_full > 0 then
formspec = {
@ -353,7 +352,8 @@ function store.get_formspec(dlgdata)
"container[0.375,0.375]",
"field[0,0;7.225,0.8;search_string;;", core.formspec_escape(search_string), "]",
"field_close_on_enter[search_string;false]",
"button[7.225,0;2,0.8;search;", fgettext("Search"), "]",
"image_button[7.3,0;0.8,0.8;", core.formspec_escape(defaulttexturedir .. "search.png"), ";search;]",
"image_button[8.125,0;0.8,0.8;", core.formspec_escape(defaulttexturedir .. "clear.png"), ";clear;]",
"dropdown[9.6,0;2.4,0.8;type;", table.concat(filter_types_titles, ","), ";", filter_type, "]",
"container_end[]",
@ -504,6 +504,13 @@ function store.handle_submit(this, fields)
return true
end
if fields.clear then
search_string = ""
cur_page = 1
store.filter_packages("")
return true
end
if fields.back then
this:delete()
return true