Fixed lost selection when selecting object while place on face gizmo is active

This commit is contained in:
Enrico Turri 2018-11-30 12:49:31 +01:00
parent b83468e763
commit 918a7f8ddd
2 changed files with 8 additions and 2 deletions

View file

@ -1043,6 +1043,7 @@ GLCanvas3D::Mouse::Drag::Drag()
GLCanvas3D::Mouse::Mouse() GLCanvas3D::Mouse::Mouse()
: dragging(false) : dragging(false)
, left_down(false)
, position(DBL_MAX, DBL_MAX) , position(DBL_MAX, DBL_MAX)
#if ENABLE_GIZMOS_ON_TOP #if ENABLE_GIZMOS_ON_TOP
, scene_position(DBL_MAX, DBL_MAX, DBL_MAX) , scene_position(DBL_MAX, DBL_MAX, DBL_MAX)
@ -4533,6 +4534,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
} }
else if (evt.LeftDown() || evt.RightDown()) else if (evt.LeftDown() || evt.RightDown())
{ {
m_mouse.left_down = evt.LeftDown();
// If user pressed left or right button we first check whether this happened // If user pressed left or right button we first check whether this happened
// on a volume or not. // on a volume or not.
m_layers_editing.state = LayersEditing::Unknown; m_layers_editing.state = LayersEditing::Unknown;
@ -4596,6 +4599,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
{ {
m_toolbar_action_running = true; m_toolbar_action_running = true;
m_toolbar.do_action((unsigned int)toolbar_contains_mouse); m_toolbar.do_action((unsigned int)toolbar_contains_mouse);
m_mouse.left_down = false;
} }
else else
{ {
@ -4614,7 +4618,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
m_selection.remove(m_hover_volume_id); m_selection.remove(m_hover_volume_id);
else else
{ {
bool add_as_single = !already_selected && !evt.ShiftDown(); bool add_as_single = !already_selected && !shift_down;
m_selection.add(m_hover_volume_id, add_as_single); m_selection.add(m_hover_volume_id, add_as_single);
} }
@ -4872,6 +4876,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
m_mouse.set_start_position_3D_as_invalid(); m_mouse.set_start_position_3D_as_invalid();
m_mouse.set_start_position_2D_as_invalid(); m_mouse.set_start_position_2D_as_invalid();
m_mouse.dragging = false; m_mouse.dragging = false;
m_mouse.left_down = false;
m_toolbar_action_running = false; m_toolbar_action_running = false;
m_dirty = true; m_dirty = true;
@ -5554,7 +5559,7 @@ void GLCanvas3D::_picking_pass() const
{ {
const Vec2d& pos = m_mouse.position; const Vec2d& pos = m_mouse.position;
if (m_picking_enabled && !m_mouse.dragging && (pos != Vec2d(DBL_MAX, DBL_MAX))) if (m_picking_enabled && !m_mouse.dragging && !m_mouse.left_down && (pos != Vec2d(DBL_MAX, DBL_MAX)))
{ {
// Render the object for picking. // Render the object for picking.
// FIXME This cannot possibly work in a multi - sampled context as the color gets mangled by the anti - aliasing. // FIXME This cannot possibly work in a multi - sampled context as the color gets mangled by the anti - aliasing.

View file

@ -323,6 +323,7 @@ class GLCanvas3D
}; };
bool dragging; bool dragging;
bool left_down;
Vec2d position; Vec2d position;
#if ENABLE_GIZMOS_ON_TOP #if ENABLE_GIZMOS_ON_TOP
Vec3d scene_position; Vec3d scene_position;