New selection -> Changed selection logic == Use SHIFT for both add to selection and remove from selection

This commit is contained in:
Enrico Turri 2018-10-22 08:54:04 +02:00
parent 70f4ca3f5b
commit 68f77f1031
2 changed files with 5 additions and 7 deletions

View File

@ -3989,10 +3989,10 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
#if ENABLE_EXTENDED_SELECTION
if (evt.LeftDown() && (m_hover_volume_id != -1))
{
if (evt.ControlDown())
m_selection.remove(m_hover_volume_id);
else
if (!evt.ShiftDown() || !m_selection.contains_volume(m_hover_volume_id))
m_selection.add(m_hover_volume_id, !evt.ShiftDown());
else
m_selection.remove(m_hover_volume_id);
m_gizmos.update_on_off_state(m_selection);
update_gizmos_data();
@ -6644,9 +6644,6 @@ void GLCanvas3D::_on_move(const std::vector<int>& volume_idxs)
#if !ENABLE_EXTENDED_SELECTION
void GLCanvas3D::_on_select(int volume_idx, int object_idx)
{
#if ENABLE_EXTENDED_SELECTION
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
#else
int vol_id = -1;
int obj_id = -1;
@ -6675,7 +6672,6 @@ void GLCanvas3D::_on_select(int volume_idx, int object_idx)
post_event(ObjectSelectEvent(obj_id, vol_id));
wxGetApp().obj_list()->select_current_volume(obj_id, vol_id);
#endif // !ENABLE_EXTENDED_SELECTION
}
#endif // !ENABLE_EXTENDED_SELECTION

View File

@ -485,6 +485,8 @@ public:
bool is_from_single_instance() const { return get_instance_idx() != -1; }
bool is_from_single_object() const { return get_object_idx() != -1; }
bool contains_volume(unsigned int volume_idx) const { return std::find(m_list.begin(), m_list.end(), volume_idx) != m_list.end(); }
// Returns the the object id if the selection is from a single object, otherwise is -1
int get_object_idx() const;
// Returns the instance id if the selection is from a single object and from a single instance, otherwise is -1