1
0
Fork 0

Fix: Viewport drag tooltips not being removed when dragging over other windows

pull/8975/head
Jonathan G Rennison 2021-04-05 12:30:58 +01:00 committed by Michael Lutz
parent ae94b2d296
commit 3ede756d23
3 changed files with 8 additions and 1 deletions

View File

@ -766,6 +766,12 @@ struct TooltipsWindow : public Window
case TCC_RIGHT_CLICK: if (!_right_button_down) delete this; break; case TCC_RIGHT_CLICK: if (!_right_button_down) delete this; break;
case TCC_HOVER: if (!_mouse_hovering) delete this; break; case TCC_HOVER: if (!_mouse_hovering) delete this; break;
case TCC_NONE: break; case TCC_NONE: break;
case TCC_EXIT_VIEWPORT: {
Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
if (w == nullptr || IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y) == nullptr) delete this;
break;
}
} }
} }
}; };

View File

@ -2637,7 +2637,7 @@ void UpdateTileSelection()
* @param params (optional) up to 5 pieces of additional information that may be added to a tooltip * @param params (optional) up to 5 pieces of additional information that may be added to a tooltip
* @param close_cond Condition for closing this tooltip. * @param close_cond Condition for closing this tooltip.
*/ */
static inline void ShowMeasurementTooltips(StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_cond = TCC_NONE) static inline void ShowMeasurementTooltips(StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_cond = TCC_EXIT_VIEWPORT)
{ {
if (!_settings_client.gui.measure_tooltip) return; if (!_settings_client.gui.measure_tooltip) return;
GuiShowTooltips(_thd.GetCallbackWnd(), str, paramcount, params, close_cond); GuiShowTooltips(_thd.GetCallbackWnd(), str, paramcount, params, close_cond);

View File

@ -268,6 +268,7 @@ enum TooltipCloseCondition {
TCC_RIGHT_CLICK, TCC_RIGHT_CLICK,
TCC_HOVER, TCC_HOVER,
TCC_NONE, TCC_NONE,
TCC_EXIT_VIEWPORT,
}; };
/** /**