diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2019-01-16 13:10:24 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2019-01-16 13:10:24 +0300 |
commit | 52493e17397cac76e79d66ff0d8651863a6468f2 (patch) | |
tree | a143bde039f99817cc41830456a72d12f87186f4 /src | |
parent | 02a22ba991b5516c2ec749e7fd920046e1722744 (diff) |
Show gizmos and toolbars tooltips when hovering on a disabled item
Diffstat (limited to 'src')
-rw-r--r-- | src/slic3r/GUI/GLCanvas3D.cpp | 19 | ||||
-rw-r--r-- | src/slic3r/GUI/GLToolbar.cpp | 20 |
2 files changed, 18 insertions, 21 deletions
diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 9a2ea4b44..93ba79f2c 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2800,13 +2800,13 @@ std::string GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, con float icon_size = (float)it->second->get_textures_size() * OverlayIconsScale; + bool inside = (OverlayBorder <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= OverlayBorder + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size); + if (inside) + name = it->second->get_name(); + if (it->second->is_activable(selection) && (it->second->get_state() != GLGizmoBase::On)) - { - bool inside = (OverlayBorder <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= OverlayBorder + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size); it->second->set_state(inside ? GLGizmoBase::Hover : GLGizmoBase::Off); - if (inside) - name = it->second->get_name(); - } + top_y += (icon_size + OverlayGapY); } @@ -5365,9 +5365,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) std::string tooltip = ""; // updates gizmos overlay - if (!m_selection.is_empty()) - tooltip = m_gizmos.update_hover_state(*this, m_mouse.position, m_selection); - else + tooltip = m_gizmos.update_hover_state(*this, m_mouse.position, m_selection); + if (m_selection.is_empty()) m_gizmos.reset_all_states(); // updates toolbar overlay @@ -5452,7 +5451,9 @@ void GLCanvas3D::set_tooltip(const std::string& tooltip) const wxToolTip* t = m_canvas->GetToolTip(); if (t != nullptr) { - if (t->GetTip() != tooltip) + if (tooltip.empty()) + m_canvas->UnsetToolTip(); + else t->SetTip(tooltip); } else diff --git a/src/slic3r/GUI/GLToolbar.cpp b/src/slic3r/GUI/GLToolbar.cpp index 0efc19dee..8a9c12f26 100644 --- a/src/slic3r/GUI/GLToolbar.cpp +++ b/src/slic3r/GUI/GLToolbar.cpp @@ -530,6 +530,8 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC GLToolbarItem::EState state = item->get_state(); bool inside = (left <= (float)scaled_mouse_pos(0)) && ((float)scaled_mouse_pos(0) <= right) && (bottom <= (float)scaled_mouse_pos(1)) && ((float)scaled_mouse_pos(1) <= top); + if (inside) + tooltip = item->get_tooltip(); switch (state) { @@ -545,9 +547,7 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC } case GLToolbarItem::Hover: { - if (inside) - tooltip = item->get_tooltip(); - else + if (!inside) { item->set_state(GLToolbarItem::Normal); parent.set_as_dirty(); @@ -567,9 +567,7 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC } case GLToolbarItem::HoverPressed: { - if (inside) - tooltip = item->get_tooltip(); - else + if (!inside) { item->set_state(GLToolbarItem::Pressed); parent.set_as_dirty(); @@ -623,6 +621,8 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan GLToolbarItem::EState state = item->get_state(); bool inside = (left <= (float)scaled_mouse_pos(0)) && ((float)scaled_mouse_pos(0) <= right) && (bottom <= (float)scaled_mouse_pos(1)) && ((float)scaled_mouse_pos(1) <= top); + if (inside) + tooltip = item->get_tooltip(); switch (state) { @@ -638,9 +638,7 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan } case GLToolbarItem::Hover: { - if (inside) - tooltip = item->get_tooltip(); - else + if (!inside) { item->set_state(GLToolbarItem::Normal); parent.set_as_dirty(); @@ -660,9 +658,7 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan } case GLToolbarItem::HoverPressed: { - if (inside) - tooltip = item->get_tooltip(); - else + if (!inside) { item->set_state(GLToolbarItem::Pressed); parent.set_as_dirty(); |