diff options
author | Muhammad Rifqi Priyo Susanto <muhammadrifqipriyosusanto@gmail.com> | 2017-09-30 00:50:42 +0700 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2018-02-20 15:21:59 +0000 |
commit | 0f015b28a30f77e006528a36c8d5b7705b0d6423 (patch) | |
tree | 3af62849731ed295e9d7254e1708c126bed137fd | |
parent | cf98f5bbc03c41501f15a76c039b15735d53f18e (diff) | |
download | minetest-0f015b28a30f77e006528a36c8d5b7705b0d6423.tar.gz minetest-0f015b28a30f77e006528a36c8d5b7705b0d6423.tar.bz2 minetest-0f015b28a30f77e006528a36c8d5b7705b0d6423.zip |
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.
-rw-r--r-- | builtin/mainmenu/dlg_delete_world.lua | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/builtin/mainmenu/dlg_delete_world.lua b/builtin/mainmenu/dlg_delete_world.lua index 1e5af1feb..df1091033 100644 --- a/builtin/mainmenu/dlg_delete_world.lua +++ b/builtin/mainmenu/dlg_delete_world.lua @@ -17,39 +17,36 @@ local function delete_world_formspec(dialogdata) - local retval = - "size[11.5,4.5,true]" .. - "label[2,2;" .. + "size[10,2.5,true]" .. + "label[0.5,0.5;" .. fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" .. - "button[3.25,3.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[0.5,1.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" .. + "button[7.0,1.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]" return retval end local function delete_world_buttonhandler(this, fields) if fields["world_delete_confirm"] then - 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) menudata.worldlist:refresh() end this:delete() return true end - + if fields["world_delete_cancel"] then this:delete() return true end - + return false 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(index_to_del ~= nil and type(index_to_del) == "number") @@ -59,6 +56,6 @@ function create_delete_world_dlg(name_to_del,index_to_del) nil) retval.data.delete_name = name_to_del retval.data.delete_index = index_to_del - + return retval end |