@@ -2234,10 +2234,23 @@ void GUIFormSpecMenu::drawList(const ListDrawSpec &s, int phase)
2234
2234
m_tooltip_element->setVisible (true );
2235
2235
this ->bringToFront (m_tooltip_element);
2236
2236
m_tooltip_element->setText (narrow_to_wide (tooltip_text).c_str ());
2237
- s32 tooltip_x = m_pointer.X + m_btn_height;
2238
- s32 tooltip_y = m_pointer.Y + m_btn_height;
2239
2237
s32 tooltip_width = m_tooltip_element->getTextWidth () + m_btn_height;
2240
2238
s32 tooltip_height = m_tooltip_element->getTextHeight () * tt_rows.size () + 5 ;
2239
+ v2u32 screenSize = driver->getScreenSize ();
2240
+ int tooltip_offset_x = m_btn_height;
2241
+ int tooltip_offset_y = m_btn_height;
2242
+ #ifdef __ANDROID__
2243
+ tooltip_offset_x *= 3 ;
2244
+ tooltip_offset_y = 0 ;
2245
+ if (m_pointer.X > (s32)screenSize.X / 2 )
2246
+ tooltip_offset_x = (tooltip_offset_x + tooltip_width) * -1 ;
2247
+ #endif
2248
+ s32 tooltip_x = m_pointer.X + tooltip_offset_x;
2249
+ s32 tooltip_y = m_pointer.Y + tooltip_offset_y;
2250
+ if (tooltip_x + tooltip_width > (s32)screenSize.X )
2251
+ tooltip_x = (s32)screenSize.X - tooltip_width - m_btn_height;
2252
+ if (tooltip_y + tooltip_height > (s32)screenSize.Y )
2253
+ tooltip_y = (s32)screenSize.Y - tooltip_height - m_btn_height;
2241
2254
m_tooltip_element->setRelativePosition (core::rect<s32>(
2242
2255
core::position2d<s32>(tooltip_x, tooltip_y),
2243
2256
core::dimension2d<s32>(tooltip_width, tooltip_height)));
@@ -2453,13 +2466,23 @@ void GUIFormSpecMenu::drawMenu()
2453
2466
if (m_old_tooltip != m_tooltips[iter->fname ].tooltip ) {
2454
2467
m_old_tooltip = m_tooltips[iter->fname ].tooltip ;
2455
2468
m_tooltip_element->setText (narrow_to_wide (m_tooltips[iter->fname ].tooltip ).c_str ());
2456
- s32 tooltip_x = m_pointer.X + m_btn_height;
2457
- s32 tooltip_y = m_pointer.Y + m_btn_height;
2458
- s32 tooltip_width = m_tooltip_element->getTextWidth () + m_btn_height;
2459
- if (tooltip_x + tooltip_width > (s32)screenSize.X )
2460
- tooltip_x = (s32)screenSize.X - tooltip_width - m_btn_height;
2461
2469
std::vector<std::string> tt_rows = str_split (m_tooltips[iter->fname ].tooltip , ' \n ' );
2470
+ s32 tooltip_width = m_tooltip_element->getTextWidth () + m_btn_height;
2462
2471
s32 tooltip_height = m_tooltip_element->getTextHeight () * tt_rows.size () + 5 ;
2472
+ int tooltip_offset_x = m_btn_height;
2473
+ int tooltip_offset_y = m_btn_height;
2474
+ #ifdef __ANDROID__
2475
+ tooltip_offset_x *= 3 ;
2476
+ tooltip_offset_y = 0 ;
2477
+ if (m_pointer.X > (s32)screenSize.X / 2 )
2478
+ tooltip_offset_x = (tooltip_offset_x + tooltip_width) * -1 ;
2479
+ #endif
2480
+ s32 tooltip_x = m_pointer.X + tooltip_offset_x;
2481
+ s32 tooltip_y = m_pointer.Y + tooltip_offset_y;
2482
+ if (tooltip_x + tooltip_width > (s32)screenSize.X )
2483
+ tooltip_x = (s32)screenSize.X - tooltip_width - m_btn_height;
2484
+ if (tooltip_y + tooltip_height > (s32)screenSize.Y )
2485
+ tooltip_y = (s32)screenSize.Y - tooltip_height - m_btn_height;
2463
2486
m_tooltip_element->setRelativePosition (core::rect<s32>(
2464
2487
core::position2d<s32>(tooltip_x, tooltip_y),
2465
2488
core::dimension2d<s32>(tooltip_width, tooltip_height)));
0 commit comments