#9483 - Added keyboard shortcut CTRL+D to toggle the visibility of the printbed reference axes

This commit is contained in:
enricoturri1966 2023-03-07 08:59:33 +01:00
parent d99364d74d
commit f038eca52c
4 changed files with 25 additions and 12 deletions

View File

@ -366,6 +366,9 @@ std::tuple<Bed3D::Type, std::string, std::string> Bed3D::detect_type(const Point
void Bed3D::render_axes() void Bed3D::render_axes()
{ {
if (!m_show_axes)
return;
if (m_build_volume.valid()) if (m_build_volume.valid())
#if ENABLE_WORLD_COORDINATE #if ENABLE_WORLD_COORDINATE
m_axes.render(Transform3d::Identity(), 0.25f); m_axes.render(Transform3d::Identity(), 0.25f);

View File

@ -84,6 +84,7 @@ private:
#endif // ENABLE_WORLD_COORDINATE #endif // ENABLE_WORLD_COORDINATE
float m_scale_factor{ 1.0f }; float m_scale_factor{ 1.0f };
bool m_show_axes{ true };
public: public:
Bed3D() = default; Bed3D() = default;
@ -111,6 +112,8 @@ public:
bool contains(const Point& point) const; bool contains(const Point& point) const;
Point point_projection(const Point& point) const; Point point_projection(const Point& point) const;
void toggle_show_axes() { m_show_axes = !m_show_axes; }
void render(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor, bool show_axes, bool show_texture); void render(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor, bool show_axes, bool show_texture);
void render_for_picking(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor); void render_for_picking(GLCanvas3D& canvas, const Transform3d& view_matrix, const Transform3d& projection_matrix, bool bottom, float scale_factor);

View File

@ -2349,6 +2349,23 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
#endif /* __APPLE__ */ #endif /* __APPLE__ */
post_event(SimpleEvent(EVT_GLTOOLBAR_COPY)); post_event(SimpleEvent(EVT_GLTOOLBAR_COPY));
break; break;
#ifdef __APPLE__
case 'd':
case 'D':
#else /* __APPLE__ */
case WXK_CONTROL_D:
#endif /* __APPLE__ */
m_bed.toggle_show_axes();
m_dirty = true;
break;
#ifdef __APPLE__
case 'f':
case 'F':
#else /* __APPLE__ */
case WXK_CONTROL_F:
#endif /* __APPLE__ */
_activate_search_toolbar_item();
break;
#ifdef __APPLE__ #ifdef __APPLE__
case 'm': case 'm':
case 'M': case 'M':
@ -2385,18 +2402,6 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
#endif /* __APPLE__ */ #endif /* __APPLE__ */
post_event(SimpleEvent(EVT_GLTOOLBAR_PASTE)); post_event(SimpleEvent(EVT_GLTOOLBAR_PASTE));
break; break;
#ifdef __APPLE__
case 'f':
case 'F':
#else /* __APPLE__ */
case WXK_CONTROL_F:
#endif /* __APPLE__ */
_activate_search_toolbar_item();
break;
#ifdef __APPLE__ #ifdef __APPLE__
case 'y': case 'y':
case 'Y': case 'Y':

View File

@ -151,6 +151,7 @@ void KBShortcutsDialog::fill_shortcuts()
{ L("Arrow Right"), L("Move selection 10 mm in positive X direction") }, { L("Arrow Right"), L("Move selection 10 mm in positive X direction") },
{ std::string("Shift+") + L("Any arrow"), L("Movement step set to 1 mm") }, { std::string("Shift+") + L("Any arrow"), L("Movement step set to 1 mm") },
{ ctrl + L("Any arrow"), L("Movement in camera space") }, { ctrl + L("Any arrow"), L("Movement in camera space") },
{ ctrl + "D", L("Show/hide reference axes") },
{ L("Page Up"), L("Rotate selection 45 degrees CCW") }, { L("Page Up"), L("Rotate selection 45 degrees CCW") },
{ L("Page Down"), L("Rotate selection 45 degrees CW") }, { L("Page Down"), L("Rotate selection 45 degrees CW") },
{ "M", L("Gizmo move") }, { "M", L("Gizmo move") },
@ -231,6 +232,7 @@ void KBShortcutsDialog::fill_shortcuts()
{ "X", L("On/Off one layer mode of the vertical slider") }, { "X", L("On/Off one layer mode of the vertical slider") },
{ "L", L("Show/Hide legend") }, { "L", L("Show/Hide legend") },
{ "C", L("Show/Hide G-code window") }, { "C", L("Show/Hide G-code window") },
{ ctrl + "D", L("Show/hide reference axes") },
}; };
m_full_shortcuts.push_back({ { _L("Preview"), "" }, preview_shortcuts }); m_full_shortcuts.push_back({ { _L("Preview"), "" }, preview_shortcuts });