forked from Mirrorlandia_minetest/minetest
Delete world dialog: Move buttons to avoid double click deletion
Move confirmation delete button to never overlap initial delete button, to avoid world deletion by accidental double click.
This commit is contained in:
parent
cf98f5bbc0
commit
0f015b28a3
@ -17,21 +17,19 @@
|
|||||||
|
|
||||||
|
|
||||||
local function delete_world_formspec(dialogdata)
|
local function delete_world_formspec(dialogdata)
|
||||||
|
|
||||||
local retval =
|
local retval =
|
||||||
"size[11.5,4.5,true]" ..
|
"size[10,2.5,true]" ..
|
||||||
"label[2,2;" ..
|
"label[0.5,0.5;" ..
|
||||||
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" ..
|
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" ..
|
||||||
"button[3.25,3.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
|
"button[0.5,1.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
|
||||||
"button[5.75,3.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
|
"button[7.0,1.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
|
||||||
local function delete_world_buttonhandler(this, fields)
|
local function delete_world_buttonhandler(this, fields)
|
||||||
if fields["world_delete_confirm"] then
|
if fields["world_delete_confirm"] then
|
||||||
|
|
||||||
if this.data.delete_index > 0 and
|
if this.data.delete_index > 0 and
|
||||||
this.data.delete_index <= #menudata.worldlist:get_raw_list() then
|
this.data.delete_index <= #menudata.worldlist:get_raw_list() then
|
||||||
core.delete_world(this.data.delete_index)
|
core.delete_world(this.data.delete_index)
|
||||||
menudata.worldlist:refresh()
|
menudata.worldlist:refresh()
|
||||||
end
|
end
|
||||||
@ -48,8 +46,7 @@ local function delete_world_buttonhandler(this, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function create_delete_world_dlg(name_to_del,index_to_del)
|
function create_delete_world_dlg(name_to_del, index_to_del)
|
||||||
|
|
||||||
assert(name_to_del ~= nil and type(name_to_del) == "string" and name_to_del ~= "")
|
assert(name_to_del ~= nil and type(name_to_del) == "string" and name_to_del ~= "")
|
||||||
assert(index_to_del ~= nil and type(index_to_del) == "number")
|
assert(index_to_del ~= nil and type(index_to_del) == "number")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user