More input handling fixes
This commit is contained in:
parent
cb900aa5bc
commit
051ca410f6
3 changed files with 15 additions and 5 deletions
|
@ -4119,6 +4119,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
||||||
, m_multisample_allowed(false)
|
, m_multisample_allowed(false)
|
||||||
, m_regenerate_volumes(true)
|
, m_regenerate_volumes(true)
|
||||||
, m_moving(false)
|
, m_moving(false)
|
||||||
|
, m_tab_down(false)
|
||||||
, m_color_by("volume")
|
, m_color_by("volume")
|
||||||
, m_reload_delayed(false)
|
, m_reload_delayed(false)
|
||||||
, m_render_sla_auxiliaries(true)
|
, m_render_sla_auxiliaries(true)
|
||||||
|
@ -5314,6 +5315,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
||||||
|
|
||||||
void GLCanvas3D::on_key(wxKeyEvent& evt)
|
void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||||
{
|
{
|
||||||
|
const int keyCode = evt.GetKeyCode();
|
||||||
|
|
||||||
#if ENABLE_IMGUI
|
#if ENABLE_IMGUI
|
||||||
auto imgui = wxGetApp().imgui();
|
auto imgui = wxGetApp().imgui();
|
||||||
if (imgui->update_key_data(evt)) {
|
if (imgui->update_key_data(evt)) {
|
||||||
|
@ -5321,9 +5324,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||||
} else
|
} else
|
||||||
#endif // ENABLE_IMGUI
|
#endif // ENABLE_IMGUI
|
||||||
if (evt.GetEventType() == wxEVT_KEY_UP) {
|
if (evt.GetEventType() == wxEVT_KEY_UP) {
|
||||||
const int keyCode = evt.GetKeyCode();
|
if (m_tab_down && keyCode == WXK_TAB && !evt.HasAnyModifiers()) {
|
||||||
|
|
||||||
if (keyCode == WXK_TAB) {
|
|
||||||
// Enable switching between 3D and Preview with Tab
|
// Enable switching between 3D and Preview with Tab
|
||||||
// m_canvas->HandleAsNavigationKey(evt); // XXX: Doesn't work in some cases / on Linux
|
// m_canvas->HandleAsNavigationKey(evt); // XXX: Doesn't work in some cases / on Linux
|
||||||
post_event(SimpleEvent(EVT_GLCANVAS_TAB));
|
post_event(SimpleEvent(EVT_GLCANVAS_TAB));
|
||||||
|
@ -5331,9 +5332,17 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||||
// shift has been just released - SLA gizmo might want to close rectangular selection.
|
// shift has been just released - SLA gizmo might want to close rectangular selection.
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
|
} else if (evt.GetEventType() == wxEVT_KEY_DOWN) {
|
||||||
|
m_tab_down = keyCode == WXK_TAB && !evt.HasAnyModifiers();
|
||||||
}
|
}
|
||||||
|
|
||||||
evt.Skip(); // Needed to have EVT_CHAR generated as well
|
if (keyCode != WXK_TAB
|
||||||
|
&& keyCode != WXK_LEFT
|
||||||
|
&& keyCode != WXK_UP
|
||||||
|
&& keyCode != WXK_RIGHT
|
||||||
|
&& keyCode != WXK_DOWN) {
|
||||||
|
evt.Skip(); // Needed to have EVT_CHAR generated as well
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
|
void GLCanvas3D::on_mouse_wheel(wxMouseEvent& evt)
|
||||||
|
|
|
@ -946,6 +946,7 @@ private:
|
||||||
bool m_multisample_allowed;
|
bool m_multisample_allowed;
|
||||||
bool m_regenerate_volumes;
|
bool m_regenerate_volumes;
|
||||||
bool m_moving;
|
bool m_moving;
|
||||||
|
bool m_tab_down;
|
||||||
bool m_render_sla_auxiliaries;
|
bool m_render_sla_auxiliaries;
|
||||||
|
|
||||||
std::string m_color_by;
|
std::string m_color_by;
|
||||||
|
|
|
@ -52,7 +52,7 @@ View3D::~View3D()
|
||||||
|
|
||||||
bool View3D::init(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process)
|
bool View3D::init(wxWindow* parent, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process)
|
||||||
{
|
{
|
||||||
if (!Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize))
|
if (!Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 /* disable wxTAB_TRAVERSAL */))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_canvas_widget = GLCanvas3DManager::create_wxglcanvas(this);
|
m_canvas_widget = GLCanvas3DManager::create_wxglcanvas(this);
|
||||||
|
|
Loading…
Add table
Reference in a new issue