diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index dd80b9948..c55d64b47 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2662,19 +2662,6 @@ std::string format_mouse_event_debug_message(const wxMouseEvent &evt) void GLCanvas3D::on_mouse(wxMouseEvent& evt) { - auto mouse_up_cleanup = [this](){ - m_moving = false; - m_mouse.drag.move_volume_idx = -1; - m_mouse.set_start_position_3D_as_invalid(); - m_mouse.set_start_position_2D_as_invalid(); - m_mouse.dragging = false; - m_mouse.ignore_left_up = false; - m_dirty = true; - - if (m_canvas->HasCapture()) - m_canvas->ReleaseMouse(); - }; - #if ENABLE_RETINA_GL const float scale = m_retina_helper->get_scale_factor(); evt.SetX(evt.GetX() * scale); @@ -3511,6 +3498,20 @@ void GLCanvas3D::export_toolpaths_to_obj(const char* filename) const m_volumes.export_toolpaths_to_obj(filename); } +void GLCanvas3D::mouse_up_cleanup() +{ + m_moving = false; + m_mouse.drag.move_volume_idx = -1; + m_mouse.set_start_position_3D_as_invalid(); + m_mouse.set_start_position_2D_as_invalid(); + m_mouse.dragging = false; + m_mouse.ignore_left_up = false; + m_dirty = true; + + if (m_canvas->HasCapture()) + m_canvas->ReleaseMouse(); +} + bool GLCanvas3D::_is_shown_on_screen() const { return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false; diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index fb767360c..2c2676ae7 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -624,6 +624,8 @@ public: bool has_toolpaths_to_export() const; void export_toolpaths_to_obj(const char* filename) const; + void mouse_up_cleanup(); + private: bool _is_shown_on_screen() const; diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 879ebc752..a5317b8a6 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -778,7 +778,13 @@ void ObjectList::OnChar(wxKeyEvent& event) void ObjectList::OnContextMenu(wxDataViewEvent&) { - list_manipulation(true); + // Do not show the context menu if the user pressed the right mouse button on the 3D scene and released it on the objects list + GLCanvas3D* canvas = wxGetApp().plater()->canvas3D(); + bool evt_context_menu = (canvas != nullptr) ? !canvas->is_mouse_dragging() : true; + if (!evt_context_menu) + canvas->mouse_up_cleanup(); + + list_manipulation(evt_context_menu); } void ObjectList::list_manipulation(bool evt_context_menu/* = false*/) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.hpp b/src/slic3r/GUI/GUI_ObjectManipulation.hpp index 7d53034b2..e6f99ab2a 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.hpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.hpp @@ -118,7 +118,7 @@ class ObjectManipulation : public OG_Settings wxStaticBitmap* m_fix_throught_netfab_bitmap; #ifndef __APPLE__ - // Currently focused option name (empty if none) + // Currently focused editor (nullptr if none) ManipulationEditor* m_focused_editor {nullptr}; #endif // __APPLE__ @@ -161,7 +161,11 @@ public: void update_warning_icon_state(const wxString& tooltip); void msw_rescale(); void on_change(const std::string& opt_key, int axis, double new_value); - void set_focused_editor(ManipulationEditor* focused_editor) { m_focused_editor = focused_editor; } + void set_focused_editor(ManipulationEditor* focused_editor) { +#ifndef __APPLE__ + m_focused_editor = focused_editor; +#endif // __APPLE__ + } private: void reset_settings_value(); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 087519c2c..1cf425334 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -579,6 +579,9 @@ void ObjectDataViewModelNode::set_action_and_extruder_icons() m_type & (itVolume | itLayer) ? "cog" : /*m_type & itInstance*/ "set_separate_obj"; m_action_icon = create_scaled_bitmap(nullptr, m_action_icon_name); // FIXME: pass window ptr + if (m_type & itInstance) + return; // don't set colored bitmap for Instance + // set extruder bitmap int extruder_idx = atoi(m_extruder.c_str()); if (extruder_idx > 0) --extruder_idx; @@ -2149,7 +2152,7 @@ wxWindow* BitmapChoiceRenderer::CreateEditorCtrl(wxWindow* parent, wxRect labelR wxDataViewCtrl* const dv_ctrl = GetOwner()->GetOwner(); ObjectDataViewModel* const model = dynamic_cast(dv_ctrl->GetModel()); - if (!(model->GetItemType(dv_ctrl->GetSelection()) & (itVolume | itObject))) + if (!(model->GetItemType(dv_ctrl->GetSelection()) & (itVolume | itLayer | itObject))) return nullptr; std::vector icons = get_extruder_color_icons();