Sidebar matrix fields focus handling

This commit is contained in:
Enrico Turri 2018-12-18 10:40:53 +01:00
parent 8854276965
commit 334f747fa9
3 changed files with 18 additions and 3 deletions

View file

@ -3581,6 +3581,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
, m_view_toolbar(nullptr) , m_view_toolbar(nullptr)
#endif // ENABLE_REMOVE_TABS_FROM_PLATER #endif // ENABLE_REMOVE_TABS_FROM_PLATER
, m_use_clipping_planes(false) , m_use_clipping_planes(false)
, m_sidebar_field("")
, m_config(nullptr) , m_config(nullptr)
, m_process(nullptr) , m_process(nullptr)
, m_model(nullptr) , m_model(nullptr)
@ -5566,6 +5567,17 @@ void GLCanvas3D::update_gizmos_on_off_state()
m_gizmos.update_on_off_state(get_selection()); m_gizmos.update_on_off_state(get_selection());
} }
void GLCanvas3D::handle_sidebar_focus_event(const std::string& opt_key, bool focus_on)
{
m_sidebar_field = focus_on ? opt_key : "";
if (!m_sidebar_field.empty())
{
m_gizmos.reset_all_states();
m_dirty = true;
}
}
bool GLCanvas3D::_is_shown_on_screen() const bool GLCanvas3D::_is_shown_on_screen() const
{ {
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false; return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;

View file

@ -794,6 +794,7 @@ private:
ClippingPlane m_clipping_planes[2]; ClippingPlane m_clipping_planes[2];
bool m_use_clipping_planes; bool m_use_clipping_planes;
mutable SlaCap m_sla_caps[2]; mutable SlaCap m_sla_caps[2];
std::string m_sidebar_field;
mutable GLVolumeCollection m_volumes; mutable GLVolumeCollection m_volumes;
Selection m_selection; Selection m_selection;
@ -995,7 +996,7 @@ public:
void viewport_changed(); void viewport_changed();
#endif // ENABLE_CONSTRAINED_CAMERA_TARGET #endif // ENABLE_CONSTRAINED_CAMERA_TARGET
void handle_sidebar_focus_event(const std::string& opt_key) {} void handle_sidebar_focus_event(const std::string& opt_key, bool focus_on);
private: private:
bool _is_shown_on_screen() const; bool _is_shown_on_screen() const;

View file

@ -41,6 +41,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
change_scale_value(new_value); change_scale_value(new_value);
else if (param == "size") else if (param == "size")
change_size_value(new_value); change_size_value(new_value);
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event(opt_key, false);
}; };
m_og->m_fill_empty_value = [this](const std::string& opt_key) m_og->m_fill_empty_value = [this](const std::string& opt_key)
@ -76,11 +78,12 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
} }
m_og->set_value(opt_key, double_to_string(value)); m_og->set_value(opt_key, double_to_string(value));
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event(opt_key, false);
}; };
m_og->m_set_focus = [this](const std::string& opt_key) m_og->m_set_focus = [this](const std::string& opt_key)
{ {
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event(opt_key); wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event(opt_key, true);
}; };
ConfigOptionDef def; ConfigOptionDef def;
@ -300,7 +303,6 @@ void ObjectManipulation::reset_rotation_value()
void ObjectManipulation::reset_scale_value() void ObjectManipulation::reset_scale_value()
{ {
m_og->set_value("scale_unit", _("%"));
m_og->set_value("scale_x", def_100); m_og->set_value("scale_x", def_100);
m_og->set_value("scale_y", def_100); m_og->set_value("scale_y", def_100);
m_og->set_value("scale_z", def_100); m_og->set_value("scale_z", def_100);