summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDS <vorunbekannt75@web.de>2022-09-13 13:48:28 +0200
committersfan5 <sfan5@live.de>2022-09-14 13:48:06 +0200
commitb9f6832347e5a0ca9e10f0d45b2eb1a4c5d82d28 (patch)
treef03e032a5655c1edd69a8614aa8be84538e0b494
parentf8bb0cd3d1da9d2d9d8dffe78cd0fb651e16a8af (diff)
downloadminetest-b9f6832347e5a0ca9e10f0d45b2eb1a4c5d82d28.tar.gz
minetest-b9f6832347e5a0ca9e10f0d45b2eb1a4c5d82d28.tar.bz2
minetest-b9f6832347e5a0ca9e10f0d45b2eb1a4c5d82d28.zip
Fix tooltips for dropdown, scrollbar and more (#12747)
-rw-r--r--src/gui/guiFormSpecMenu.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp
index 1f9914e72..62936743c 100644
--- a/src/gui/guiFormSpecMenu.cpp
+++ b/src/gui/guiFormSpecMenu.cpp
@@ -825,9 +825,9 @@ void GUIFormSpecMenu::parseImage(parserData* data, const std::string &element)
core::rect<s32> middle;
if (parts.size() >= 4)
parseMiddleRect(parts[3], &middle);
-
+
// Temporary fix for issue #12581 in 5.6.0.
- // Use legacy image when not rendering 9-slice image because GUIAnimatedImage
+ // Use legacy image when not rendering 9-slice image because GUIAnimatedImage
// uses NNAA filter which causes visual artifacts when image uses alpha blending.
gui::IGUIElement *e;
@@ -3643,13 +3643,21 @@ void GUIFormSpecMenu::drawMenu()
#endif
bool hovered_element_found = false;
- if (hovered != NULL) {
+ if (hovered) {
if (m_show_debug) {
core::rect<s32> rect = hovered->getAbsoluteClippingRect();
driver->draw2DRectangle(0x22FFFF00, rect, &rect);
}
- s32 id = hovered->getID();
+ // find the formspec-element of the hovered IGUIElement (a parent)
+ s32 id;
+ for (gui::IGUIElement *hovered_fselem = hovered; hovered_fselem;
+ hovered_fselem = hovered_fselem->getParent()) {
+ id = hovered_fselem->getID();
+ if (id != -1)
+ break;
+ }
+
u64 delta = 0;
if (id == -1) {
m_old_tooltip_id = id;