Add tooltips to the map formspec
This commit is contained in:
parent
e16893f82e
commit
8f0e161b7c
@ -32,7 +32,7 @@ local function show_map_id_formspec(id, player_x, player_z, player_name, height_
|
|||||||
formspec = formspec .. string.format("image_button[0.125,0.125;0.5,0.5;%s.png;height_button;]", cartographer.skin.flat_button_texture)
|
formspec = formspec .. string.format("image_button[0.125,0.125;0.5,0.5;%s.png;height_button;]", cartographer.skin.flat_button_texture)
|
||||||
end
|
end
|
||||||
|
|
||||||
formspec = formspec .. "container_end[]";
|
formspec = formspec .. "tooltip[height_button;Toggle height view] container_end[]";
|
||||||
end
|
end
|
||||||
minetest.show_formspec(player_name, "cartographer:map", formspec);
|
minetest.show_formspec(player_name, "cartographer:map", formspec);
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
function _cartographer.generate_marker_formspec(selected_id, detail, page, bg, button)
|
function _cartographer.generate_marker_formspec(selected_id, detail, page, bg, button)
|
||||||
local fs = string.format("background9[0,0;3.25,3.875;%s.png;false;%s]", bg.texture, tostring(bg.radius))
|
local fs = string.format("background9[0,0;3.25,3.875;%s.png;false;%s]", bg.texture, tostring(bg.radius))
|
||||||
.. string.format("style_type[button,image_button;border=false;bgimg=%s.png;bgimg_hovered=%s.png;bgimg_pressed=%s.png;bgimg_middle=%s;textcolor=%s]", button.texture, button.hovered_texture, button.pressed_texture, tostring(button.radius), button.font_color)
|
.. string.format("style_type[button,image_button;border=false;bgimg=%s.png;bgimg_hovered=%s.png;bgimg_pressed=%s.png;bgimg_middle=%s;textcolor=%s]", button.texture, button.hovered_texture, button.pressed_texture, tostring(button.radius), button.font_color)
|
||||||
.. "button[0.125,0.125;1.125,0.5;clear_marker;Erase]";
|
.. "button[0.125,0.125;1.125,0.5;clear_marker;Erase] tooltip[clear_marker;Remove the selected marker]";
|
||||||
if selected_id then
|
if selected_id then
|
||||||
fs = fs .. string.format("style[marker-%s;bgimg=%s.png;bgimg_hovered=%s.png;bgimg_pressed=%s.png]", selected_id, button.selected_texture, button.selected_texture, button.selected_texture);
|
fs = fs .. string.format("style[marker-%s;bgimg=%s.png;bgimg_hovered=%s.png;bgimg_pressed=%s.png]", selected_id, button.selected_texture, button.selected_texture, button.selected_texture);
|
||||||
end
|
end
|
||||||
@ -18,11 +18,13 @@ function _cartographer.generate_marker_formspec(selected_id, detail, page, bg, b
|
|||||||
local starting_id = ((page - 1) * 20) + 1;
|
local starting_id = ((page - 1) * 20) + 1;
|
||||||
for i = starting_id,math.min(#_cartographer.marker_lookup,starting_id + 19),1 do
|
for i = starting_id,math.min(#_cartographer.marker_lookup,starting_id + 19),1 do
|
||||||
local marker = _cartographer.marker_lookup[i];
|
local marker = _cartographer.marker_lookup[i];
|
||||||
fs = fs .. string.format("image_button[%f,%f;0.5,0.5;%s.png;marker-%s;]",
|
fs = fs .. string.format("image_button[%f,%f;0.5,0.5;%s.png;marker-%s;] tooltip[marker-%s;%s]",
|
||||||
(i - starting_id) % 5 * 0.625 + 0.125,
|
(i - starting_id) % 5 * 0.625 + 0.125,
|
||||||
math.floor((i - starting_id) / 5) * 0.625 + 0.75,
|
math.floor((i - starting_id) / 5) * 0.625 + 0.75,
|
||||||
marker.textures[math.min(detail, #marker.textures)],
|
marker.textures[math.min(detail, #marker.textures)],
|
||||||
marker.id);
|
marker.id,
|
||||||
|
marker.id,
|
||||||
|
marker.name);
|
||||||
end
|
end
|
||||||
|
|
||||||
if page > 1 then
|
if page > 1 then
|
||||||
|
Loading…
Reference in New Issue
Block a user