FIX:Canvas focus (STUDIO-2384)
https://github.com/bambulab/BambuStudio/issues/1465 https://github.com/bambulab/BambuStudio/issues/1339 two enhancement: Moving mouse cursor to GLCanvas shouldn't cause focused parameter textbox lose its focus. When GLCanvas lose focus, the imgui textInput should lose focus too. Change-Id: I616bb98f87c2dc59669220d3b5a6c3e120a8f06f
This commit is contained in:
parent
3f2ee4062b
commit
b193566996
|
@ -2778,6 +2778,11 @@ void GLCanvas3D::bind_event_handlers()
|
|||
m_canvas->Bind(wxEVT_RIGHT_DCLICK, &GLCanvas3D::on_mouse, this);
|
||||
m_canvas->Bind(wxEVT_PAINT, &GLCanvas3D::on_paint, this);
|
||||
m_canvas->Bind(wxEVT_SET_FOCUS, &GLCanvas3D::on_set_focus, this);
|
||||
m_canvas->Bind(wxEVT_KILL_FOCUS, [this](wxFocusEvent& evt) {
|
||||
ImGui::SetWindowFocus(nullptr);
|
||||
render();
|
||||
evt.Skip();
|
||||
});
|
||||
m_event_handlers_bound = true;
|
||||
|
||||
m_canvas->Bind(wxEVT_GESTURE_PAN, &GLCanvas3D::on_gesture, this);
|
||||
|
@ -3748,6 +3753,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
m_mouse.ignore_left_up = true;
|
||||
m_tooltip.set_in_imgui(false);
|
||||
if (imgui->update_mouse_data(evt)) {
|
||||
if (evt.LeftDown() && m_canvas != nullptr)
|
||||
m_canvas->SetFocus();
|
||||
m_mouse.position = evt.Leaving() ? Vec2d(-1.0, -1.0) : pos.cast<double>();
|
||||
m_tooltip.set_in_imgui(true);
|
||||
render();
|
||||
|
@ -3910,7 +3917,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
p = p->GetParent();
|
||||
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
|
||||
if (top_level_wnd && top_level_wnd->IsActive() && !wxGetApp().get_side_menu_popup_status())
|
||||
m_canvas->SetFocus();
|
||||
;// m_canvas->SetFocus();
|
||||
m_mouse.position = pos.cast<double>();
|
||||
m_tooltip_enabled = false;
|
||||
// 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while
|
||||
|
|
Loading…
Reference in New Issue