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_regenerate_volumes(true)
|
||||
, m_moving(false)
|
||||
, m_tab_down(false)
|
||||
, m_color_by("volume")
|
||||
, m_reload_delayed(false)
|
||||
, m_render_sla_auxiliaries(true)
|
||||
|
@ -5314,6 +5315,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
|
||||
void GLCanvas3D::on_key(wxKeyEvent& evt)
|
||||
{
|
||||
const int keyCode = evt.GetKeyCode();
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
auto imgui = wxGetApp().imgui();
|
||||
if (imgui->update_key_data(evt)) {
|
||||
|
@ -5321,9 +5324,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
|
|||
} else
|
||||
#endif // ENABLE_IMGUI
|
||||
if (evt.GetEventType() == wxEVT_KEY_UP) {
|
||||
const int keyCode = evt.GetKeyCode();
|
||||
|
||||
if (keyCode == WXK_TAB) {
|
||||
if (m_tab_down && keyCode == WXK_TAB && !evt.HasAnyModifiers()) {
|
||||
// Enable switching between 3D and Preview with Tab
|
||||
// m_canvas->HandleAsNavigationKey(evt); // XXX: Doesn't work in some cases / on Linux
|
||||
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.
|
||||
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)
|
||||
|
|
|
@ -946,6 +946,7 @@ private:
|
|||
bool m_multisample_allowed;
|
||||
bool m_regenerate_volumes;
|
||||
bool m_moving;
|
||||
bool m_tab_down;
|
||||
bool m_render_sla_auxiliaries;
|
||||
|
||||
std::string m_color_by;
|
||||
|
|
|
@ -52,7 +52,7 @@ View3D::~View3D()
|
|||
|
||||
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;
|
||||
|
||||
m_canvas_widget = GLCanvas3DManager::create_wxglcanvas(this);
|
||||
|
|
Loading…
Reference in a new issue