Add dirty state into Gizmo (hint by @DavidKocik)

This commit is contained in:
Filip Sykala 2021-08-20 09:13:09 +02:00
parent cce3041a95
commit 8fab4885c7
4 changed files with 28 additions and 2 deletions

View file

@ -85,6 +85,7 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, u
, m_dragging(false)
, m_imgui(wxGetApp().imgui())
, m_first_input_window_render(true)
, m_dirty(false)
{
m_base_color = DEFAULT_BASE_COLOR;
m_drag_color = DEFAULT_DRAG_COLOR;
@ -154,6 +155,14 @@ void GLGizmoBase::update(const UpdateData& data)
on_update(data);
}
bool GLGizmoBase::update_items_state()
{
std::lock_guard<std::mutex> g(m_dirty_access);
bool res = m_dirty;
m_dirty = false;
return res;
};
std::array<float, 4> GLGizmoBase::picking_color_component(unsigned int id) const
{
static const float INV_255 = 1.0f / 255.0f;
@ -209,6 +218,11 @@ std::string GLGizmoBase::format(float value, unsigned int decimals) const
return Slic3r::string_printf("%.*f", decimals, value);
}
void GLGizmoBase::set_dirty() {
std::lock_guard<std::mutex> g(m_dirty_access);
m_dirty = true;
}
void GLGizmoBase::render_input_window(float x, float y, float bottom_limit)
{
on_render_input_window(x, y, bottom_limit);