FIX:limit input value for text depth

jira: none
Change-Id: Ie11d8bf7c24da6bfc37469a76055f819b716b9d4
This commit is contained in:
zhou.xu 2024-10-10 18:06:07 +08:00 committed by Lane.Wei
parent 466c1e7f00
commit a26a7f126a
2 changed files with 11 additions and 7 deletions

View File

@ -904,9 +904,10 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
m_imgui->text(_L("Size"));
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(input_size);
if(ImGui::InputFloat("###font_size", &m_font_size, 0.0f, 0.0f, "%.2f"))
if (ImGui::InputFloat("###font_size", &m_font_size, 0.0f, 0.0f, "%.2f")) {
limit_value(m_font_size, m_font_size_min, m_font_size_max);
m_need_update_text = true;
if (m_font_size < 3.0f)m_font_size = 3.0f;
}
ImGui::SameLine();
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f * currt_scale);
@ -968,9 +969,9 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
ImGui::SameLine(caption_size);
ImGui::PushItemWidth(list_width);
old_value = m_embeded_depth;
ImGui::InputFloat("###text_embeded_depth", &m_embeded_depth, 0.0f, 0.0f, "%.2f");
if (m_embeded_depth < 0.f)
m_embeded_depth = 0.f;
if (ImGui::InputFloat("###text_embeded_depth", &m_embeded_depth, 0.0f, 0.0f, "%.2f")) {
limit_value(m_embeded_depth, 0.0f, m_embeded_depth_max);
}
if (old_value != m_embeded_depth)
m_need_update_text = true;

View File

@ -23,13 +23,16 @@ private:
char m_text[1024] = { 0 };
std::string m_font_name;
float m_font_size = 16.f;
const float m_font_size_min = 3.f;
const float m_font_size_max = 1000.f;
int m_curr_font_idx = 0;
bool m_bold = true;
bool m_italic = false;
float m_thickness = 2.f;
float m_thickness_min = 0.01f;
float m_thickness_max = 999.99f;
const float m_thickness_min = 0.01f;
const float m_thickness_max = 1000.f;
float m_embeded_depth = 0.f;
const float m_embeded_depth_max = 1000.f;
float m_rotate_angle = 0;
float m_text_gap = 0.f;
bool m_is_surface_text = false;