Delayed update of ObjectManipulation panel from the Canvas3D:

Store the changes into temps and apply it to the wxWidgets on idle.
This commit is contained in:
bubnikv 2018-12-20 20:12:26 +01:00
parent f56bb7d085
commit f799f2eb48
3 changed files with 106 additions and 134 deletions

View file

@ -23,6 +23,19 @@ class ObjectManipulation : public OG_Settings
wxStaticText* m_scale_Label = nullptr;
wxStaticText* m_rotate_Label = nullptr;
// Needs to be updated from OnIdle?
bool m_dirty = false;
// Cached labels for the delayed update, not localized!
std::string m_new_move_label_string;
std::string m_new_rotate_label_string;
std::string m_new_scale_label_string;
Vec3d m_new_position;
Vec3d m_new_rotation;
Vec3d m_new_scale;
Vec3d m_new_size;
bool m_new_enabled;
public:
ObjectManipulation(wxWindow* parent);
~ObjectManipulation() {}
@ -31,19 +44,14 @@ public:
bool IsShown() override;
void UpdateAndShow(const bool show) override;
int ol_selection();
void update_settings_value(const GLCanvas3D::Selection& selection);
void update_settings_value(const GLCanvas3D::Selection& selection);
// Called from the App to update the UI if dirty.
void update_if_dirty();
private:
void reset_settings_value();
void reset_position_value();
void reset_rotation_value();
void reset_scale_value();
void reset_size_value();
// update position values displacements or "gizmos"
void update_position_value(const Vec3d& position);
// update scale values after scale unit changing or "gizmos"
void update_scale_value(const Vec3d& scaling_factor);
// update size values after scale unit changing or "gizmos"
void update_size_value(const Vec3d& size);
// update rotation value after "gizmos"