Tech ENABLE_RAYCAST_PICKING - Fixed wrong behavior when pressing CTRL while dragging a model on the plate

This commit is contained in:
enricoturri1966 2022-07-14 14:45:19 +02:00
parent f9f2be9936
commit f06a931d0b

View file

@ -2968,7 +2968,11 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
}
else if (keyCode == WXK_CONTROL) {
#if ENABLE_NEW_CAMERA_MOVEMENTS
#if ENABLE_RAYCAST_PICKING
if (m_mouse.dragging && !m_moving) {
#else
if (m_mouse.dragging) {
#endif // ENABLE_RAYCAST_PICKING
// if the user releases CTRL while rotating the 3D scene
// prevent from moving the selected volume
m_mouse.drag.move_volume_idx = -1;
@ -3498,7 +3502,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
#endif // ENABLE_NEW_CAMERA_MOVEMENTS
m_mouse.drag.start_position_3D = m_mouse.scene_position;
m_sequential_print_clearance_first_displacement = true;
#if !ENABLE_RAYCAST_PICKING
m_moving = true;
#endif // !ENABLE_RAYCAST_PICKING
}
}
}
@ -3546,6 +3552,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
}
#if ENABLE_WORLD_COORDINATE
#if ENABLE_RAYCAST_PICKING
m_moving = true;
#endif // ENABLE_RAYCAST_PICKING
TransformationType trafo_type;
trafo_type.set_relative();
m_selection.translate(cur_pos - m_mouse.drag.start_position_3D, trafo_type);
@ -3577,6 +3586,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
#if ENABLE_NEW_CAMERA_MOVEMENTS
else if (evt.LeftIsDown()) {
// if dragging over blank area with left button, rotate
#if ENABLE_RAYCAST_PICKING
if (!m_moving) {
#endif // ENABLE_RAYCAST_PICKING
if ((any_gizmo_active || evt.CmdDown() || m_hover_volume_idxs.empty()) && m_mouse.is_start_position_3D_defined()) {
#else
// if dragging over blank area with left button, rotate
@ -3600,6 +3612,9 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
m_dirty = true;
}
m_mouse.drag.start_position_3D = Vec3d((double)pos.x(), (double)pos.y(), 0.0);
#if ENABLE_RAYCAST_PICKING
}
#endif // ENABLE_RAYCAST_PICKING
}
else if (evt.MiddleIsDown() || evt.RightIsDown()) {
// If dragging over blank area with right/middle button, pan.