diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 5a837f14d..d49198ca8 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1,3 +1,4 @@ +#include "libslic3r/libslic3r.h" #include "GUI_ObjectList.hpp" #include "GUI_ObjectManipulation.hpp" #include "GUI_App.hpp" @@ -1283,6 +1284,14 @@ void ObjectList::append_menu_item_delete(wxMenu* menu) [this](wxCommandEvent&) { remove(); }, "", menu); } +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME +void ObjectList::append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu) +{ + append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")), + [this](wxCommandEvent&) { wxGetApp().plater()->scale_selection_to_fit_print_volume(); }, "", menu); +} +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void ObjectList::create_object_popupmenu(wxMenu *menu) { #ifdef __WXOSX__ @@ -1291,6 +1300,9 @@ void ObjectList::create_object_popupmenu(wxMenu *menu) append_menu_item_export_stl(menu); append_menu_item_fix_through_netfabb(menu); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + append_menu_item_scale_selection_to_fit_print_volume(menu); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME // Split object to parts m_menu_item_split = append_menu_item_split(menu); diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index 0dcfe2560..d030b5c51 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -207,6 +207,9 @@ public: void append_menu_item_export_stl(wxMenu* menu) const ; void append_menu_item_change_extruder(wxMenu* menu) const; void append_menu_item_delete(wxMenu* menu); +#if ENABLE_SCALE_TO_FIT_PRINT_VOLUME + void append_menu_item_scale_selection_to_fit_print_volume(wxMenu* menu); +#endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME void create_object_popupmenu(wxMenu *menu); void create_sla_object_popupmenu(wxMenu*menu); void create_part_popupmenu(wxMenu*menu); diff --git a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp index ceffd6e0d..492629324 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmosManager.cpp @@ -853,7 +853,9 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt, GLCanvas3D& canvas) { if (m_current == Scale) { - wxGetApp().plater()->scale_selection_to_fit_print_volume(); + if (!is_dragging()) + wxGetApp().plater()->scale_selection_to_fit_print_volume(); + processed = true; } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 22f239516..c82955b09 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3021,8 +3021,7 @@ bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/ sidebar->obj_list()->append_menu_item_fix_through_netfabb(menu); #if ENABLE_SCALE_TO_FIT_PRINT_VOLUME - append_menu_item(menu, wxID_ANY, _(L("Scale to print volume")), _(L("Scale the selected object to fit the print volume")), - [this](wxCommandEvent&) { scale_selection_to_fit_print_volume(); }, "", menu); + sidebar->obj_list()->append_menu_item_scale_selection_to_fit_print_volume(menu); #endif // ENABLE_SCALE_TO_FIT_PRINT_VOLUME wxMenu* mirror_menu = new wxMenu();