Fixed interference between tooltips and imgui dialogs

This commit is contained in:
enricoturri1966 2020-03-18 10:46:46 +01:00
parent a85a2b2e2a
commit 1c1a6b933a
2 changed files with 11 additions and 4 deletions

View File

@ -3309,13 +3309,19 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
Point pos(evt.GetX(), evt.GetY());
ImGuiWrapper *imgui = wxGetApp().imgui();
ImGuiWrapper* imgui = wxGetApp().imgui();
if (imgui->update_mouse_data(evt)) {
m_mouse.position = evt.Leaving() ? Vec2d(-1.0, -1.0) : pos.cast<double>();
render();
#ifdef SLIC3R_DEBUG_MOUSE_EVENTS
printf((format_mouse_event_debug_message(evt) + " - Consumed by ImGUI\n").c_str());
#endif /* SLIC3R_DEBUG_MOUSE_EVENTS */
// do not return if dragging or tooltip not empty to allow for tooltip update
#if ENABLE_CANVAS_TOOLTIP_USING_IMGUI
if (!m_mouse.dragging && m_tooltip.is_empty())
#else
if (!m_mouse.dragging && m_canvas->GetToolTipText().empty())
#endif // ENABLE_CANVAS_TOOLTIP_USING_IMGUI
return;
}

View File

@ -401,6 +401,7 @@ private:
#endif // ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
public:
bool is_empty() const { return m_text.empty(); }
#if ENABLE_CANVAS_DELAYED_TOOLTIP_USING_IMGUI
void set_text(const std::string& text);
void render(const Vec2d& mouse_position, GLCanvas3D& canvas) const;