#4395, #4701, #1336 - Added the ability to invert the scroll wheel when zooming

This commit is contained in:
enricoturri1966 2020-11-02 13:08:13 +01:00
parent 516db43b20
commit 9dbc0c6ba2
3 changed files with 16 additions and 2 deletions

View File

@ -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())

View File

@ -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)

View File

@ -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<ConfigOptionsGroup>(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();