Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QoL: Keyboard shortcuts updates & fixes #3457

Merged
merged 4 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/slic3r/GUI/GLCanvas3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3221,8 +3221,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
// }
// break;
//}
//case 'I':
//case 'i': { _update_camera_zoom(1.0); break; }
case 'I':
case 'i': { _update_camera_zoom(1.0); break; }
//case 'K':
//case 'k': { wxGetApp().plater()->get_camera().select_next_type(); m_dirty = true; break; }
//case 'L':
Expand All @@ -3234,8 +3234,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
//}
//break;
//}
//case 'O':
//case 'o': { _update_camera_zoom(-1.0); break; }
case 'O':
case 'o': { _update_camera_zoom(-1.0); break; }
//case 'Z':
//case 'z': {
// if (!m_selection.is_empty())
Expand Down
23 changes: 16 additions & 7 deletions src/slic3r/GUI/Gizmos/GLGizmosManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,24 @@ bool GLGizmosManager::is_running() const

bool GLGizmosManager::handle_shortcut(int key)
{
if (!m_enabled || m_parent.get_selection().is_empty())
if (!m_enabled)
return false;

auto it = std::find_if(m_gizmos.begin(), m_gizmos.end(),
[key](const std::unique_ptr<GLGizmoBase>& gizmo) {
int gizmo_key = gizmo->get_shortcut_key();
return gizmo->is_activable()
&& ((gizmo_key == key - 64) || (gizmo_key == key - 96));
});
auto is_key = [pressed_key = key](int gizmo_key) { return (gizmo_key == pressed_key - 64) || (gizmo_key == pressed_key - 96); };
// allowe open shortcut even when selection is empty
if (GLGizmoBase* gizmo_emboss = m_gizmos[Emboss].get();
is_key(gizmo_emboss->get_shortcut_key())) {
dynamic_cast<GLGizmoEmboss *>(gizmo_emboss)->on_shortcut_key();
return true;
}

if (m_parent.get_selection().is_empty())
return false;

auto is_gizmo = [is_key](const std::unique_ptr<GLGizmoBase> &gizmo) {
return gizmo->is_activable() && is_key(gizmo->get_shortcut_key());
};
auto it = std::find_if(m_gizmos.begin(), m_gizmos.end(), is_gizmo);

if (it == m_gizmos.end())
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/slic3r/GUI/KBShortcutsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ void KBShortcutsDialog::fill_shortcuts()
{ "F", L("Gizmo Place face on bed") },
{ "L", L("Gizmo SLA support points") },
{ "P", L("Gizmo FDM paint-on seam") },
{ "T", L("Gizmo Text emboss / engrave")},
{ "I", L("Zoom in")},
{ "O", L("Zoom out")},
{ "Tab", L("Switch between Prepare/Preview") },

};
Expand Down