Fix for #2519 - Takes focus away from input box when moving cursor to plater
Take focus away only, if ObjectList was focused, when mouse cursor is moved to 3d-Scene
This commit is contained in:
parent
9e65fc1cac
commit
656a1d262a
@ -47,8 +47,6 @@
|
||||
#define ENABLE_PREVIEW_LAYER_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable showing time estimate for travel moves in legend
|
||||
#define ENABLE_TRAVEL_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable not killing focus in object manipulator fields when hovering over 3D scene
|
||||
#define ENABLE_OBJECT_MANIPULATOR_FOCUS (0 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of wipe tower magic object_id equal to 1000
|
||||
#define ENABLE_WIPETOWER_OBJECTID_1000_REMOVAL (1 && ENABLE_2_5_0_ALPHA1)
|
||||
// Enable removal of legacy OpenGL calls
|
||||
|
@ -3311,9 +3311,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||
mouse_up_cleanup();
|
||||
m_mouse.set_start_position_3D_as_invalid();
|
||||
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
handle_sidebar_focus_event("", false);
|
||||
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3321,9 +3318,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||
mouse_up_cleanup();
|
||||
m_mouse.set_start_position_3D_as_invalid();
|
||||
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
handle_sidebar_focus_event("", false);
|
||||
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3331,9 +3325,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||
mouse_up_cleanup();
|
||||
m_mouse.set_start_position_3D_as_invalid();
|
||||
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
handle_sidebar_focus_event("", false);
|
||||
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3341,9 +3332,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||
mouse_up_cleanup();
|
||||
m_mouse.set_start_position_3D_as_invalid();
|
||||
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
handle_sidebar_focus_event("", false);
|
||||
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3388,9 +3376,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
handle_sidebar_focus_event("", false);
|
||||
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3405,39 +3390,27 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
m_mouse.set_move_start_threshold_position_2D_as_invalid();
|
||||
}
|
||||
|
||||
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
if (evt.ButtonDown()) {
|
||||
std::string curr_sidebar_field = m_sidebar_field;
|
||||
handle_sidebar_focus_event("", false);
|
||||
if (boost::algorithm::istarts_with(curr_sidebar_field, "layer"))
|
||||
// restore visibility of layers hints after left clicking on the 3D scene
|
||||
m_sidebar_field = curr_sidebar_field;
|
||||
if (wxWindow::FindFocus() != m_canvas)
|
||||
// Grab keyboard focus on any mouse click event.
|
||||
m_canvas->SetFocus();
|
||||
}
|
||||
#else
|
||||
if (evt.ButtonDown() && wxWindow::FindFocus() != m_canvas)
|
||||
// Grab keyboard focus on any mouse click event.
|
||||
m_canvas->SetFocus();
|
||||
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
|
||||
if (evt.Entering()) {
|
||||
//#if defined(__WXMSW__) || defined(__linux__)
|
||||
// // On Windows and Linux needs focus in order to catch key events
|
||||
#if !ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
// Set focus in order to remove it from sidebar fields
|
||||
#endif // !ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
// Set focus in order to remove it from object list
|
||||
if (m_canvas != nullptr) {
|
||||
#if !ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
// Only set focus, if the top level window of this canvas is active.
|
||||
// Only set focus, if the top level window of this canvas is active
|
||||
// and ObjectList has a focus
|
||||
auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
|
||||
while (p->GetParent())
|
||||
p = p->GetParent();
|
||||
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
|
||||
if (top_level_wnd && top_level_wnd->IsActive())
|
||||
#ifdef __WIN32__
|
||||
wxWindow* const obj_list = wxGetApp().obj_list()->GetMainWindow();
|
||||
#else
|
||||
wxWindow* const obj_list = wxGetApp().obj_list();
|
||||
#endif
|
||||
if (obj_list == p->FindFocus())
|
||||
m_canvas->SetFocus();
|
||||
#endif // !ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
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
|
||||
|
@ -1442,12 +1442,7 @@ ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
|
||||
{
|
||||
parent->set_focused_editor(nullptr);
|
||||
|
||||
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
// if the widgets loosing focus is a manipulator field, call kill_focus
|
||||
if (dynamic_cast<ManipulationEditor*>(e.GetEventObject()) != nullptr)
|
||||
#else
|
||||
if (!m_enter_pressed)
|
||||
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||
kill_focus(parent);
|
||||
|
||||
e.Skip();
|
||||
|
Loading…
Reference in New Issue
Block a user