Nearly finished refactoring of GLGizmoManager

This commit is contained in:
Lukas Matena 2019-09-02 14:25:48 +02:00
parent 409a7c7734
commit d8a274c5ab
6 changed files with 142 additions and 291 deletions

View file

@ -66,16 +66,17 @@ public:
private:
GLCanvas3D& m_parent;
bool m_enabled;
typedef std::map<EType, GLGizmoBase*> GizmosMap;
// GizmosMap m_gizmos;
typedef std::vector<GLGizmoBase*> Gizmos;
Gizmos m_gizmos;
std::vector<std::unique_ptr<GLGizmoBase>> m_gizmos;
mutable GLTexture m_icons_texture;
mutable bool m_icons_texture_dirty;
BackgroundTexture m_background_texture;
EType m_current;
EType m_hover;
std::vector<size_t> get_selectable_idxs() const;
std::vector<size_t> get_activable_idxs() const;
size_t get_gizmo_idx_from_mouse(const Vec2d& mouse_pos) const;
void activate_gizmo(EType type);
float m_overlay_icons_size;
@ -102,7 +103,6 @@ private:
public:
explicit GLGizmosManager(GLCanvas3D& parent);
~GLGizmosManager();
bool init();
@ -114,10 +114,7 @@ public:
m_serializing = true;
EType current = m_current;
ar(m_current);
//std::swap(current, m_current); // undo the deserialization, let activate_gizmo do the change
//activate_gizmo(current);
if (m_current != Undefined)
m_gizmos[m_current]->load(ar);
@ -193,8 +190,6 @@ public:
void update_after_undo_redo(const UndoRedo::Snapshot& snapshot);
private:
void reset();
void render_background(float left, float top, float right, float bottom, float border) const;
void do_render_overlay() const;
@ -207,7 +202,6 @@ private:
void update_on_off_state(const Vec2d& mouse_pos);
std::string update_hover_state(const Vec2d& mouse_pos);
bool overlay_contains_mouse(const Vec2d& mouse_pos) const;
bool grabber_contains_mouse() const;
};