diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index b1ea770f1..3d724db76 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3532,18 +3532,19 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) case WXK_NUMPAD_PAGEUP: case WXK_PAGEUP: case WXK_NUMPAD_PAGEDOWN: case WXK_PAGEDOWN: { - do_rotate(L("Tool Rotate")); - m_gizmos.update_data(); - - // BBS - //wxGetApp().obj_manipul()->set_dirty(); - // Let the plater know that the dragging finished, so a delayed refresh - // of the scene with the background processing data should be performed. - post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED)); - // updates camera target constraints - refresh_camera_scene_box(); - m_dirty = true; + if (m_gizmos.get_gizmo_active_condition(GLGizmosManager::EType::Rotate)) { + do_rotate(L("Tool Rotate")); + m_gizmos.update_data(); + // BBS + // wxGetApp().obj_manipul()->set_dirty(); + // Let the plater know that the dragging finished, so a delayed refresh + // of the scene with the background processing data should be performed. + post_event(SimpleEvent(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED)); + // updates camera target constraints + refresh_camera_scene_box(); + m_dirty = true; + } break; } default: { break; } @@ -3609,6 +3610,9 @@ void GLCanvas3D::on_key(wxKeyEvent& evt) post_event(SimpleEvent(EVT_GLCANVAS_COLLAPSE_SIDEBAR)); } else if (m_gizmos.is_enabled() && !m_selection.is_empty() && m_canvas_type != CanvasAssembleView) { auto _do_rotate = [this](double angle_z_rad) { + if (!m_gizmos.get_gizmo_active_condition(GLGizmosManager::EType::Rotate)) { + return; + } m_selection.start_dragging(); m_selection.rotate(Vec3d(0.0, 0.0, angle_z_rad), TransformationType(TransformationType::World_Relative_Joint)); m_selection.stop_dragging(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index e13c6d1ce..271927efe 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -684,6 +684,13 @@ bool GLGizmosManager::is_show_only_active_plate() return false; } +bool GLGizmosManager::get_gizmo_active_condition(GLGizmosManager::EType type) { + if (auto cur_gizmo = get_gizmo(type)) { + return cur_gizmo->is_activable(); + } + return false; +} + void GLGizmosManager::check_object_located_outside_plate() { PartPlateList &plate_list = wxGetApp().plater()->get_partplate_list(); auto curr_plate_index = plate_list.get_curr_plate_index(); @@ -1065,7 +1072,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt) && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation)) // don't allow dragging objects with the Sla gizmo on processed = true; - else if (evt.Dragging() && !control_down + else if (evt.Dragging() && !control_down && (m_current == SlaSupports || m_current == Hollow || m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation || m_current == Cut) && gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown())) { // the gizmo got the event and took some action, no need to do anything more here diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp index 71553bc5f..10d9070b8 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.hpp @@ -287,6 +287,7 @@ public: bool is_gizmo_activable_when_single_full_instance(); bool is_gizmo_click_empty_not_exit(); bool is_show_only_active_plate(); + bool get_gizmo_active_condition(GLGizmosManager::EType type); void check_object_located_outside_plate(); bool get_object_located_outside_plate() { return m_object_located_outside_plate; } bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position = Vec2d::Zero(), bool shift_down = false, bool alt_down = false, bool control_down = false);