aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBlockMen <nmuelll@web.de>2014-09-28 08:44:05 +0200
committerBlockMen <nmuelll@web.de>2014-09-28 08:44:05 +0200
commitb75e7148c2c6ad9a602d78d7ec6356273e3a4214 (patch)
tree2ae42b7a2ce49214d5033cfec3414810d8bc75f2 /src
parent121e8cc2a145591000282548ef07dbc70af7c6fc (diff)
downloadminetest-b75e7148c2c6ad9a602d78d7ec6356273e3a4214.tar.gz
minetest-b75e7148c2c6ad9a602d78d7ec6356273e3a4214.tar.bz2
minetest-b75e7148c2c6ad9a602d78d7ec6356273e3a4214.zip
Fix multilined description in tooltips (fixes #1688)
Diffstat (limited to 'src')
-rw-r--r--src/guiFormSpecMenu.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp
index 1c8b63299..cbba313bc 100644
--- a/src/guiFormSpecMenu.cpp
+++ b/src/guiFormSpecMenu.cpp
@@ -2141,10 +2141,10 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
// Draw tooltip
std::string tooltip_text = "";
- if(hovering && !m_selected_item)
+ if (hovering && !m_selected_item)
tooltip_text = item.getDefinition(m_gamedef->idef()).description;
- if(tooltip_text != "")
- {
+ if (tooltip_text != "") {
+ std::vector<std::string> tt_rows = split(tooltip_text,'\n');
m_tooltip_element->setBackgroundColor(m_default_tooltip_bgcolor);
m_tooltip_element->setOverrideColor(m_default_tooltip_color);
m_tooltip_element->setVisible(true);
@@ -2153,7 +2153,7 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
s32 tooltip_x = m_pointer.X + m_btn_height;
s32 tooltip_y = m_pointer.Y + m_btn_height;
s32 tooltip_width = m_tooltip_element->getTextWidth() + m_btn_height;
- s32 tooltip_height = m_tooltip_element->getTextHeight() + 5;
+ s32 tooltip_height = m_tooltip_element->getTextHeight() * tt_rows.size() + 5;
m_tooltip_element->setRelativePosition(core::rect<s32>(
core::position2d<s32>(tooltip_x, tooltip_y),
core::dimension2d<s32>(tooltip_width, tooltip_height)));