diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp index 08293ae72..abf9370d8 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.cpp @@ -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; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoText.hpp b/src/slic3r/GUI/Gizmos/GLGizmoText.hpp index 2d0e88b34..081838fac 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoText.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoText.hpp @@ -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;