From f1e0dc2dd714c9afae5d978e633646c0db8a7c57 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Thu, 20 Sep 2018 09:50:49 +0200 Subject: Ignore mouse up event after double click on gizmos grabbers --- xs/src/slic3r/GUI/GLCanvas3D.cpp | 16 +++++++++++++++- xs/src/slic3r/GUI/GLCanvas3D.hpp | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'xs') diff --git a/xs/src/slic3r/GUI/GLCanvas3D.cpp b/xs/src/slic3r/GUI/GLCanvas3D.cpp index c62652994..efb2b2dab 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.cpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.cpp @@ -1095,6 +1095,9 @@ GLCanvas3D::Mouse::Drag::Drag() GLCanvas3D::Mouse::Mouse() : dragging(false) , position(DBL_MAX, DBL_MAX) +#if ENABLE_GIZMOS_RESET + , ignore_up_event(false) +#endif // ENABLE_GIZMOS_RESET { } @@ -3058,6 +3061,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) #if ENABLE_GIZMOS_RESET else if (evt.LeftDClick() && m_gizmos.grabber_contains_mouse()) { +#if ENABLE_GIZMOS_RESET + m_mouse.ignore_up_event = true; +#endif // ENABLE_GIZMOS_RESET m_gizmos.process_double_click(); switch (m_gizmos.get_current_type()) { @@ -3075,7 +3081,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_on_gizmo_rotate_3D_callback.call(rotation(0), rotation(1), rotation(2)); #else m_on_gizmo_rotate_callback.call((double)m_gizmos.get_angle_z()); -#endif //ENABLE_MODELINSTANCE_3D_ROTATION +#endif // ENABLE_MODELINSTANCE_3D_ROTATION update_rotation_values(); m_dirty = true; break; @@ -3421,12 +3427,20 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) else if (evt.LeftUp() && !m_mouse.dragging && (m_hover_volume_id == -1) && !gizmos_overlay_contains_mouse && !m_gizmos.is_dragging() && !is_layers_editing_enabled()) { // deselect and propagate event through callback +#if ENABLE_GIZMOS_RESET + if (!m_mouse.ignore_up_event && m_picking_enabled && !m_toolbar_action_running) +#else if (m_picking_enabled && !m_toolbar_action_running) +#endif // ENABLE_GIZMOS_RESET { deselect_volumes(); _on_select(-1, -1); update_gizmos_data(); } +#if ENABLE_GIZMOS_RESET + else if (m_mouse.ignore_up_event) + m_mouse.ignore_up_event = false; +#endif // ENABLE_GIZMOS_RESET } else if (evt.LeftUp() && m_gizmos.is_dragging()) { diff --git a/xs/src/slic3r/GUI/GLCanvas3D.hpp b/xs/src/slic3r/GUI/GLCanvas3D.hpp index 2c830f58e..b123efccf 100644 --- a/xs/src/slic3r/GUI/GLCanvas3D.hpp +++ b/xs/src/slic3r/GUI/GLCanvas3D.hpp @@ -315,6 +315,9 @@ class GLCanvas3D bool dragging; Vec2d position; Drag drag; +#if ENABLE_GIZMOS_RESET + bool ignore_up_event; +#endif // ENABLE_GIZMOS_RESET Mouse(); -- cgit v1.2.3