mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
FIX: crash when setting negative thickness value on text tool
github issue #1656 Change-Id: Ib77bdd3e4b2508c466d7122a9052d1d15d6bc4bb
This commit is contained in:
parent
611b2812d3
commit
7a988c1e44
1 changed files with 13 additions and 4 deletions
|
@ -771,10 +771,12 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
||||||
m_imgui->text(_L("Thickness"));
|
m_imgui->text(_L("Thickness"));
|
||||||
ImGui::SameLine(caption_size);
|
ImGui::SameLine(caption_size);
|
||||||
ImGui::PushItemWidth(list_width);
|
ImGui::PushItemWidth(list_width);
|
||||||
if(ImGui::InputFloat("###text_thickness", &m_thickness,0.0f, 0.0f, "%.2f"))
|
float old_value = m_thickness;
|
||||||
m_need_update_text = true;
|
ImGui::InputFloat("###text_thickness", &m_thickness, 0.0f, 0.0f, "%.2f");
|
||||||
if (m_thickness < 0.1f)
|
if (m_thickness < 0.1f)
|
||||||
m_thickness = 0.1f;
|
m_thickness = 0.1f;
|
||||||
|
if (old_value != m_thickness)
|
||||||
|
m_need_update_text = true;
|
||||||
|
|
||||||
const float slider_icon_width = m_imgui->get_slider_icon_size().x;
|
const float slider_icon_width = m_imgui->get_slider_icon_size().x;
|
||||||
const float slider_width = list_width - 1.5 * slider_icon_width - space_size;
|
const float slider_width = list_width - 1.5 * slider_icon_width - space_size;
|
||||||
|
@ -806,10 +808,12 @@ void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
||||||
m_imgui->text(_L("Embeded\ndepth"));
|
m_imgui->text(_L("Embeded\ndepth"));
|
||||||
ImGui::SameLine(caption_size);
|
ImGui::SameLine(caption_size);
|
||||||
ImGui::PushItemWidth(list_width);
|
ImGui::PushItemWidth(list_width);
|
||||||
if (ImGui::InputFloat("###text_embeded_depth", &m_embeded_depth, 0.0f, 0.0f, "%.2f"))
|
old_value = m_embeded_depth;
|
||||||
m_need_update_text = true;
|
ImGui::InputFloat("###text_embeded_depth", &m_embeded_depth, 0.0f, 0.0f, "%.2f");
|
||||||
if (m_embeded_depth < 0.f)
|
if (m_embeded_depth < 0.f)
|
||||||
m_embeded_depth = 0.f;
|
m_embeded_depth = 0.f;
|
||||||
|
if (old_value != m_embeded_depth)
|
||||||
|
m_need_update_text = true;
|
||||||
|
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(_L("Input text"));
|
m_imgui->text(_L("Input text"));
|
||||||
|
@ -1468,6 +1472,11 @@ void GLGizmoText::generate_text_volume(bool is_temp)
|
||||||
|
|
||||||
TextInfo text_info = get_text_info();
|
TextInfo text_info = get_text_info();
|
||||||
if (m_is_modify && m_need_update_text) {
|
if (m_is_modify && m_need_update_text) {
|
||||||
|
if (m_object_idx == -1 || m_volume_idx == -1) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << boost::format("Text: selected object_idx = %1%, volume_idx = %2%") % m_object_idx % m_volume_idx;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
plater->take_snapshot("Modify Text");
|
plater->take_snapshot("Modify Text");
|
||||||
const Selection &selection = m_parent.get_selection();
|
const Selection &selection = m_parent.get_selection();
|
||||||
ModelObject * model_object = selection.get_model()->objects[m_object_idx];
|
ModelObject * model_object = selection.get_model()->objects[m_object_idx];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue