mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-12 18:41:51 +08:00
Tech ENABLE_OBJECT_MANIPULATOR_FOCUS - 1st installment - Do not automatically set focus on 3D scene while hovering on it while the focus is into a field of the object manipulator
This commit is contained in:
parent
403f6d45f9
commit
cfe8aa4818
@ -58,6 +58,8 @@
|
|||||||
#define ENABLE_PREVIEW_LAYER_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
#define ENABLE_PREVIEW_LAYER_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
// Enable showing time estimate for travel moves in legend
|
// Enable showing time estimate for travel moves in legend
|
||||||
#define ENABLE_TRAVEL_TIME (1 && ENABLE_2_5_0_ALPHA1)
|
#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 (1 && ENABLE_2_5_0_ALPHA1)
|
||||||
|
|
||||||
|
|
||||||
#endif // _prusaslicer_technologies_h_
|
#endif // _prusaslicer_technologies_h_
|
||||||
|
@ -2934,6 +2934,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||||
mouse_up_cleanup();
|
mouse_up_cleanup();
|
||||||
m_mouse.set_start_position_3D_as_invalid();
|
m_mouse.set_start_position_3D_as_invalid();
|
||||||
|
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
handle_sidebar_focus_event("", false);
|
||||||
|
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2941,6 +2944,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||||
mouse_up_cleanup();
|
mouse_up_cleanup();
|
||||||
m_mouse.set_start_position_3D_as_invalid();
|
m_mouse.set_start_position_3D_as_invalid();
|
||||||
|
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
handle_sidebar_focus_event("", false);
|
||||||
|
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2948,6 +2954,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||||
mouse_up_cleanup();
|
mouse_up_cleanup();
|
||||||
m_mouse.set_start_position_3D_as_invalid();
|
m_mouse.set_start_position_3D_as_invalid();
|
||||||
|
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
handle_sidebar_focus_event("", false);
|
||||||
|
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2955,6 +2964,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp())
|
||||||
mouse_up_cleanup();
|
mouse_up_cleanup();
|
||||||
m_mouse.set_start_position_3D_as_invalid();
|
m_mouse.set_start_position_3D_as_invalid();
|
||||||
|
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
handle_sidebar_focus_event("", false);
|
||||||
|
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3008,6 +3020,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
handle_sidebar_focus_event("", false);
|
||||||
|
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3022,15 +3037,27 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
m_mouse.set_move_start_threshold_position_2D_as_invalid();
|
m_mouse.set_move_start_threshold_position_2D_as_invalid();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
if (evt.ButtonDown()) {
|
||||||
|
handle_sidebar_focus_event("", false);
|
||||||
|
if (wxWindow::FindFocus() != m_canvas)
|
||||||
|
// Grab keyboard focus on any mouse click event.
|
||||||
|
m_canvas->SetFocus();
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (evt.ButtonDown() && wxWindow::FindFocus() != m_canvas)
|
if (evt.ButtonDown() && wxWindow::FindFocus() != m_canvas)
|
||||||
// Grab keyboard focus on any mouse click event.
|
// Grab keyboard focus on any mouse click event.
|
||||||
m_canvas->SetFocus();
|
m_canvas->SetFocus();
|
||||||
|
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
|
||||||
if (evt.Entering()) {
|
if (evt.Entering()) {
|
||||||
//#if defined(__WXMSW__) || defined(__linux__)
|
//#if defined(__WXMSW__) || defined(__linux__)
|
||||||
// // On Windows and Linux needs focus in order to catch key events
|
// // 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
|
// Set focus in order to remove it from sidebar fields
|
||||||
|
#endif // !ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
if (m_canvas != nullptr) {
|
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.
|
||||||
auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
|
auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
|
||||||
while (p->GetParent())
|
while (p->GetParent())
|
||||||
@ -3038,6 +3065,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
|
auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
|
||||||
if (top_level_wnd && top_level_wnd->IsActive())
|
if (top_level_wnd && top_level_wnd->IsActive())
|
||||||
m_canvas->SetFocus();
|
m_canvas->SetFocus();
|
||||||
|
#endif // !ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
m_mouse.position = pos.cast<double>();
|
m_mouse.position = pos.cast<double>();
|
||||||
m_tooltip_enabled = false;
|
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
|
// 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while
|
||||||
|
@ -1103,7 +1103,12 @@ ManipulationEditor::ManipulationEditor(ObjectManipulation* parent,
|
|||||||
{
|
{
|
||||||
parent->set_focused_editor(nullptr);
|
parent->set_focused_editor(nullptr);
|
||||||
|
|
||||||
|
#if ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
|
// if the widget loosing focus is not a manipulator field, call kill_focus
|
||||||
|
if (dynamic_cast<ManipulationEditor*>(e.GetWindow()) == nullptr)
|
||||||
|
#else
|
||||||
if (!m_enter_pressed)
|
if (!m_enter_pressed)
|
||||||
|
#endif // ENABLE_OBJECT_MANIPULATOR_FOCUS
|
||||||
kill_focus(parent);
|
kill_focus(parent);
|
||||||
|
|
||||||
e.Skip();
|
e.Skip();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user