From c3521b4d259e34796b24dad1a50c04906392aacf Mon Sep 17 00:00:00 2001 From: Kiss Lorand <50251547+kisslorand@users.noreply.github.com> Date: Tue, 16 Sep 2025 18:18:59 +0300 Subject: [PATCH] =?UTF-8?q?Reflect=20swapped=20mouse=20buttons=20in=20Help?= =?UTF-8?q?=20=E2=86=92=20Keyboard=20Shortcuts=20(#10647)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Swap function description --- src/slic3r/GUI/GLCanvas3D.cpp | 14 +++++++------- src/slic3r/GUI/KBShortcutsDialog.cpp | 6 ++++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 30cf0ad3fd..815fce5d5a 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -4111,7 +4111,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } bool any_gizmo_active = m_gizmos.get_current() != nullptr; - bool swapMouseButtons = wxGetApp().app_config->get_bool("swap_mouse_buttons"); + bool swap_mouse_buttons = wxGetApp().app_config->get_bool("swap_mouse_buttons"); if (m_mouse.drag.move_requires_threshold && m_mouse.is_move_start_threshold_position_2D_defined() && m_mouse.is_move_threshold_met(pos)) { m_mouse.drag.move_requires_threshold = false; @@ -4314,7 +4314,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_dirty = true; } } - else if (evt.Dragging() || is_camera_rotate(evt, swapMouseButtons) || is_camera_pan(evt, swapMouseButtons)) { + else if (evt.Dragging() || is_camera_rotate(evt, swap_mouse_buttons) || is_camera_pan(evt, swap_mouse_buttons)) { m_mouse.dragging = true; if (m_layers_editing.state != LayersEditing::Unknown && layer_editing_object_idx != -1) { @@ -4324,10 +4324,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } // do not process the dragging if the left mouse was set down in another canvas - else if (is_camera_rotate(evt, swapMouseButtons)) { + else if (is_camera_rotate(evt, swap_mouse_buttons)) { // Orca: Sphere rotation for painting view // if dragging over blank area with left button or button functions swapped then rotate - if ((any_gizmo_active || swapMouseButtons || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { + if ((any_gizmo_active || swap_mouse_buttons || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) { Camera& camera = wxGetApp().plater()->get_camera(); auto mult_pref = wxGetApp().app_config->get("camera_orbit_mult"); const double mult = mult_pref.empty() ? 1.0 : std::stod(mult_pref); @@ -4400,7 +4400,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_camera_movement = true; m_mouse.drag.start_position_3D = Vec3d((double)pos(0), (double)pos(1), 0.0); } - else if (is_camera_pan(evt, swapMouseButtons)) { + else if (is_camera_pan(evt, swap_mouse_buttons)) { // if dragging with right button or if button functions swapped and dragging with left button over blank area then pan if (m_mouse.is_start_position_2D_defined()) { // get point in model space at Z = 0 @@ -4427,10 +4427,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) } } else if ((evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) || - (m_camera_movement && !is_camera_rotate(evt, swapMouseButtons) && !is_camera_pan(evt, swapMouseButtons))) { + (m_camera_movement && !is_camera_rotate(evt, swap_mouse_buttons) && !is_camera_pan(evt, swap_mouse_buttons))) { m_mouse.position = pos.cast(); - if (swapMouseButtons ? evt.RightUp() : evt.LeftUp()) { + if (swap_mouse_buttons ? evt.RightUp() : evt.LeftUp()) { m_rotation_center(0) = m_rotation_center(1) = m_rotation_center(2) = 0.f; } diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index 42898270e4..62917ee64b 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -207,10 +207,12 @@ void KBShortcutsDialog::fill_shortcuts() { "?", L("Show keyboard shortcuts list") } }; m_full_shortcuts.push_back({{_L("Global shortcuts"), ""}, global_shortcuts}); + + bool swap_mouse_buttons = wxGetApp().app_config->get_bool("swap_mouse_buttons"); Shortcuts plater_shortcuts = { - { L("Left mouse button"), L("Rotate View") }, - { L("Right mouse button"), L("Pan View") }, + { L("Left mouse button"), swap_mouse_buttons ? L("Pan View") : L("Rotate View") }, + { L("Right mouse button"), swap_mouse_buttons ? L("Rotate View") : L("Pan View") }, { L("Mouse wheel"), L("Zoom View") }, { "A", L("Arrange all objects") }, { shift + "A", L("Arrange objects on selected plates") },