diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 7a0dcb52b..631ff2fb2 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -104,6 +104,9 @@ void AppConfig::set_defaults() if (get("use_free_camera").empty()) set("use_free_camera", "0"); + + if (get("reverse_mouse_wheel_zoom").empty()) + set("reverse_mouse_wheel_zoom", "0"); #endif // !ENABLE_GCODE_VIEWER #if ENABLE_ENVIRONMENT_MAP @@ -124,6 +127,9 @@ void AppConfig::set_defaults() if (get("use_free_camera").empty()) set("use_free_camera", "0"); + + if (get("reverse_mouse_wheel_zoom").empty()) + set("reverse_mouse_wheel_zoom", "0"); #endif // ENABLE_GCODE_VIEWER if (get("show_splash_screen").empty()) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index cfc3670b5..1324aec73 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3399,7 +3399,8 @@ void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt) return; // Calculate the zoom delta and apply it to the current zoom factor - _update_camera_zoom((double)evt.GetWheelRotation() / (double)evt.GetWheelDelta()); + double direction_factor = (wxGetApp().app_config->get("reverse_mouse_wheel_zoom") == "1") ? -1.0 : 1.0; + _update_camera_zoom(direction_factor * (double)evt.GetWheelRotation() / (double)evt.GetWheelDelta()); } void GLCanvas3D::on_timer(wxTimerEvent& evt) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index fb0ca410d..6acb67e66 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -195,6 +195,13 @@ void PreferencesDialog::build() option = Option(def, "use_free_camera"); m_optgroup_camera->append_single_option_line(option); + def.label = L("Reverse direction of zoom with mouse wheel"); + def.type = coBool; + def.tooltip = L("If enabled, reverses the direction of zoom with mouse wheel"); + def.set_default_value(new ConfigOptionBool(app_config->get("reverse_mouse_wheel_zoom") == "1")); + option = Option(def, "reverse_mouse_wheel_zoom"); + m_optgroup_camera->append_single_option_line(option); + m_optgroup_camera->activate(); m_optgroup_gui = std::make_shared(this, _L("GUI")); @@ -225,7 +232,6 @@ void PreferencesDialog::build() m_optgroup_gui->append_single_option_line(option); #if ENABLE_GCODE_VIEWER } -#endif // ENABLE_GCODE_VIEWER def.label = L("Sequential slider applied only to top layer"); def.type = coBool; @@ -234,6 +240,7 @@ void PreferencesDialog::build() def.set_default_value(new ConfigOptionBool{ app_config->get("seq_top_layer_only") == "1" }); option = Option(def, "seq_top_layer_only"); m_optgroup_gui->append_single_option_line(option); +#endif // ENABLE_GCODE_VIEWER m_optgroup_gui->activate();