From dddea0db2298d96eb4c98fa463431fc566ca0831 Mon Sep 17 00:00:00 2001 From: Enrico Turri Date: Mon, 15 Apr 2019 10:27:40 +0200 Subject: [PATCH] Fixed selection when right-clicking in the 3D scene to show the context menu --- src/slic3r/GUI/GLCanvas3D.cpp | 2 +- src/slic3r/GUI/Selection.cpp | 4 ++-- src/slic3r/GUI/Selection.hpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 0dc3ec83a..29cc0e4f6 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2580,7 +2580,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) m_selection.remove(m_hover_volume_id); else { - m_selection.add(m_hover_volume_id, !ctrl_down); + m_selection.add(m_hover_volume_id, !ctrl_down, true); m_mouse.drag.move_requires_threshold = !already_selected; if (already_selected) m_mouse.set_move_start_threshold_position_2D_as_invalid(); diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 957c04d69..e014851ab 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -99,7 +99,7 @@ void Selection::set_model(Model* model) update_valid(); } -void Selection::add(unsigned int volume_idx, bool as_single_selection) +void Selection::add(unsigned int volume_idx, bool as_single_selection, bool check_for_already_contained) { if (!m_valid || ((unsigned int)m_volumes->size() <= volume_idx)) return; @@ -110,7 +110,7 @@ void Selection::add(unsigned int volume_idx, bool as_single_selection) return; bool keep_instance_mode = (m_mode == Instance) && !as_single_selection; - bool already_contained = contains_volume(volume_idx); + bool already_contained = check_for_already_contained && contains_volume(volume_idx); // resets the current list if needed bool needs_reset = as_single_selection && !already_contained; diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index a8b0c06dc..87c919680 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -210,7 +210,7 @@ public: EMode get_mode() const { return m_mode; } void set_mode(EMode mode) { m_mode = mode; } - void add(unsigned int volume_idx, bool as_single_selection = true); + void add(unsigned int volume_idx, bool as_single_selection = true, bool check_for_already_contained = false); void remove(unsigned int volume_idx); void add_object(unsigned int object_idx, bool as_single_selection = true);