mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Add in a pref for camera orbit speed multiplier (#8725)
Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
parent
d869a61ac1
commit
933b282c53
4 changed files with 62 additions and 1 deletions
|
@ -181,6 +181,9 @@ void AppConfig::set_defaults()
|
||||||
if (get("reverse_mouse_wheel_zoom").empty())
|
if (get("reverse_mouse_wheel_zoom").empty())
|
||||||
set_bool("reverse_mouse_wheel_zoom", false);
|
set_bool("reverse_mouse_wheel_zoom", false);
|
||||||
|
|
||||||
|
if (get("camera_orbit_mult").empty())
|
||||||
|
set("camera_orbit_mult", "1.0");
|
||||||
|
|
||||||
if (get("zoom_to_mouse").empty())
|
if (get("zoom_to_mouse").empty())
|
||||||
set_bool("zoom_to_mouse", false);
|
set_bool("zoom_to_mouse", false);
|
||||||
|
|
||||||
|
|
|
@ -4299,7 +4299,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||||
// if dragging over blank area with left button, rotate
|
// if dragging over blank area with left button, rotate
|
||||||
if ((any_gizmo_active || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
|
if ((any_gizmo_active || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
|
||||||
Camera& camera = wxGetApp().plater()->get_camera();
|
Camera& camera = wxGetApp().plater()->get_camera();
|
||||||
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.);
|
auto mult_pref = wxGetApp().app_config->get("camera_orbit_mult");
|
||||||
|
const double mult = mult_pref.empty() ? 1.0 : std::stod(mult_pref);
|
||||||
|
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.) * mult;
|
||||||
if (this->m_canvas_type == ECanvasType::CanvasAssembleView || m_gizmos.get_current_type() == GLGizmosManager::FdmSupports ||
|
if (this->m_canvas_type == ECanvasType::CanvasAssembleView || m_gizmos.get_current_type() == GLGizmosManager::FdmSupports ||
|
||||||
m_gizmos.get_current_type() == GLGizmosManager::Seam || m_gizmos.get_current_type() == GLGizmosManager::MmuSegmentation) {
|
m_gizmos.get_current_type() == GLGizmosManager::Seam || m_gizmos.get_current_type() == GLGizmosManager::MmuSegmentation) {
|
||||||
Vec3d rotate_target = Vec3d::Zero();
|
Vec3d rotate_target = Vec3d::Zero();
|
||||||
|
|
|
@ -512,6 +512,59 @@ wxBoxSizer *PreferencesDialog::create_item_input(wxString title, wxString title2
|
||||||
return sizer_input;
|
return sizer_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBoxSizer *PreferencesDialog::create_camera_orbit_mult_input(wxString title, wxWindow *parent, wxString tooltip)
|
||||||
|
{
|
||||||
|
wxBoxSizer *sizer_input = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
auto input_title = new wxStaticText(parent, wxID_ANY, title);
|
||||||
|
input_title->SetForegroundColour(DESIGN_GRAY900_COLOR);
|
||||||
|
input_title->SetFont(::Label::Body_13);
|
||||||
|
input_title->SetToolTip(tooltip);
|
||||||
|
input_title->Wrap(-1);
|
||||||
|
auto param = "camera_orbit_mult";
|
||||||
|
|
||||||
|
auto input = new ::TextInput(parent, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, DESIGN_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
||||||
|
StateColor input_bg(std::pair<wxColour, int>(wxColour("#F0F0F1"), StateColor::Disabled), std::pair<wxColour, int>(*wxWHITE, StateColor::Enabled));
|
||||||
|
input->SetBackgroundColor(input_bg);
|
||||||
|
input->GetTextCtrl()->SetValue(app_config->get(param));
|
||||||
|
wxTextValidator validator(wxFILTER_NUMERIC);
|
||||||
|
input->GetTextCtrl()->SetValidator(validator);
|
||||||
|
|
||||||
|
sizer_input->Add(0, 0, 0, wxEXPAND | wxLEFT, 23);
|
||||||
|
sizer_input->Add(input_title, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3);
|
||||||
|
sizer_input->Add(input, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
|
sizer_input->Add(0, 0, 0, wxEXPAND | wxLEFT, 3);
|
||||||
|
|
||||||
|
const double min = 0.05;
|
||||||
|
const double max = 2.0;
|
||||||
|
|
||||||
|
input->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, param, input, min, max](wxCommandEvent &e) {
|
||||||
|
auto value = input->GetTextCtrl()->GetValue();
|
||||||
|
double conv = 1.0;
|
||||||
|
if (value.ToCDouble(&conv)) {
|
||||||
|
conv = conv < min ? min : conv > max ? max : conv;
|
||||||
|
auto strval = std::string(wxString::FromCDouble(conv, 2).mb_str());
|
||||||
|
input->GetTextCtrl()->SetValue(strval);
|
||||||
|
app_config->set(param, strval);
|
||||||
|
app_config->save();
|
||||||
|
}
|
||||||
|
e.Skip();
|
||||||
|
});
|
||||||
|
|
||||||
|
input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, param, input, min, max](wxFocusEvent &e) {
|
||||||
|
auto value = input->GetTextCtrl()->GetValue();
|
||||||
|
double conv = 1.0;
|
||||||
|
if (value.ToCDouble(&conv)) {
|
||||||
|
conv = conv < min ? min : conv > max ? max : conv;
|
||||||
|
auto strval = std::string(wxString::FromCDouble(conv, 2).mb_str());
|
||||||
|
input->GetTextCtrl()->SetValue(strval);
|
||||||
|
app_config->set(param, strval);
|
||||||
|
}
|
||||||
|
e.Skip();
|
||||||
|
});
|
||||||
|
|
||||||
|
return sizer_input;
|
||||||
|
}
|
||||||
|
|
||||||
wxBoxSizer *PreferencesDialog::create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param)
|
wxBoxSizer *PreferencesDialog::create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param)
|
||||||
{
|
{
|
||||||
wxBoxSizer *m_sizer_input = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *m_sizer_input = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
@ -1164,6 +1217,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||||
auto item_mouse_zoom_settings = create_item_checkbox(_L("Zoom to mouse position"), page, _L("Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center."), 50, "zoom_to_mouse");
|
auto item_mouse_zoom_settings = create_item_checkbox(_L("Zoom to mouse position"), page, _L("Zoom in towards the mouse pointer's position in the 3D view, rather than the 2D window center."), 50, "zoom_to_mouse");
|
||||||
auto item_use_free_camera_settings = create_item_checkbox(_L("Use free camera"), page, _L("If enabled, use free camera. If not enabled, use constrained camera."), 50, "use_free_camera");
|
auto item_use_free_camera_settings = create_item_checkbox(_L("Use free camera"), page, _L("If enabled, use free camera. If not enabled, use constrained camera."), 50, "use_free_camera");
|
||||||
auto reverse_mouse_zoom = create_item_checkbox(_L("Reverse mouse zoom"), page, _L("If enabled, reverses the direction of zoom with mouse wheel."), 50, "reverse_mouse_wheel_zoom");
|
auto reverse_mouse_zoom = create_item_checkbox(_L("Reverse mouse zoom"), page, _L("If enabled, reverses the direction of zoom with mouse wheel."), 50, "reverse_mouse_wheel_zoom");
|
||||||
|
auto camera_orbit_mult = create_camera_orbit_mult_input(_L("Orbit speed multiplier"), page, _L("Multiplies the orbit speed for finer or coarser camera movement."));
|
||||||
|
|
||||||
auto item_show_splash_screen = create_item_checkbox(_L("Show splash screen"), page, _L("Show the splash screen during startup."), 50, "show_splash_screen");
|
auto item_show_splash_screen = create_item_checkbox(_L("Show splash screen"), page, _L("Show the splash screen during startup."), 50, "show_splash_screen");
|
||||||
auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints");
|
auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints");
|
||||||
|
@ -1246,6 +1300,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
||||||
sizer_page->Add(item_mouse_zoom_settings, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_mouse_zoom_settings, 0, wxTOP, FromDIP(3));
|
||||||
sizer_page->Add(item_use_free_camera_settings, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_use_free_camera_settings, 0, wxTOP, FromDIP(3));
|
||||||
sizer_page->Add(reverse_mouse_zoom, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(reverse_mouse_zoom, 0, wxTOP, FromDIP(3));
|
||||||
|
sizer_page->Add(camera_orbit_mult, 0, wxTOP, FromDIP(3));
|
||||||
sizer_page->Add(item_show_splash_screen, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_show_splash_screen, 0, wxTOP, FromDIP(3));
|
||||||
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
|
||||||
sizer_page->Add(item_calc_in_long_retract, 0, wxTOP, FromDIP(3));
|
sizer_page->Add(item_calc_in_long_retract, 0, wxTOP, FromDIP(3));
|
||||||
|
|
|
@ -115,6 +115,7 @@ public:
|
||||||
wxBoxSizer *create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, wxString tooltip2, std::function<void()> onclick, bool button_on_left = false);
|
wxBoxSizer *create_item_button(wxString title, wxString title2, wxWindow *parent, wxString tooltip, wxString tooltip2, std::function<void()> onclick, bool button_on_left = false);
|
||||||
wxWindow* create_item_downloads(wxWindow* parent, int padding_left, std::string param);
|
wxWindow* create_item_downloads(wxWindow* parent, int padding_left, std::string param);
|
||||||
wxBoxSizer *create_item_input(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::string param, std::function<void(wxString)> onchange = {});
|
wxBoxSizer *create_item_input(wxString title, wxString title2, wxWindow *parent, wxString tooltip, std::string param, std::function<void(wxString)> onchange = {});
|
||||||
|
wxBoxSizer *create_camera_orbit_mult_input(wxString title, wxWindow *parent, wxString tooltip);
|
||||||
wxBoxSizer *create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param);
|
wxBoxSizer *create_item_backup_input(wxString title, wxWindow *parent, wxString tooltip, std::string param);
|
||||||
wxBoxSizer *create_item_multiple_combobox(
|
wxBoxSizer *create_item_multiple_combobox(
|
||||||
wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string parama, std::vector<wxString> vlista, std::vector<wxString> vlistb);
|
wxString title, wxWindow *parent, wxString tooltip, int padding_left, std::string parama, std::vector<wxString> vlista, std::vector<wxString> vlistb);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue