SLA gizmo - combobox items are now rendered immediately on mouse click, not after next mouse move

This commit is contained in:
Lukas Matena 2019-02-18 14:56:19 +01:00
parent c63bdccb4b
commit cb4763bb32
4 changed files with 10 additions and 3 deletions

View file

@ -2236,7 +2236,11 @@ RENDER_AGAIN:
std::stringstream ss;
ss << std::setprecision(1) << m_new_point_head_diameter;
wxString str = ss.str();
m_imgui->combo(_(L("Head diameter")), options, str);
bool old_combo_state = m_combo_box_open;
m_combo_box_open = m_imgui->combo(_(L("Head diameter")), options, str);
force_refresh |= (old_combo_state != m_combo_box_open);
float current_number = atof(str);
if (std::abs(current_number - m_new_point_head_diameter) > 0.001) {
force_refresh = true;

View file

@ -498,6 +498,7 @@ private:
Vec2d m_selection_rectangle_start_corner;
Vec2d m_selection_rectangle_end_corner;
bool m_ignore_up_event = false;
bool m_combo_box_open = false;
#if SLAGIZMO_IMGUI_MODAL
bool m_show_modal = false;
#endif

View file

@ -168,7 +168,7 @@ void ImGuiWrapper::text(const wxString &label)
}
void ImGuiWrapper::combo(const wxString& label, const std::vector<wxString>& options, wxString& selection)
bool ImGuiWrapper::combo(const wxString& label, const std::vector<wxString>& options, wxString& selection)
{
std::string selection_u8 = into_u8(selection);
@ -184,7 +184,9 @@ void ImGuiWrapper::combo(const wxString& label, const std::vector<wxString>& opt
selection = option_u8;
}
ImGui::EndCombo();
return true;
}
return false;
}
void ImGuiWrapper::disabled_begin(bool disabled)

View file

@ -52,7 +52,7 @@ public:
bool input_vec3(const std::string &label, const Vec3d &value, float width, const std::string &format = "%.3f");
bool checkbox(const wxString &label, bool &value);
void text(const wxString &label);
void combo(const wxString& label, const std::vector<wxString>& options, wxString& current_selection);
bool combo(const wxString& label, const std::vector<wxString>& options, wxString& current_selection);
void disabled_begin(bool disabled);
void disabled_end();