FIX: toolbar cannot rescale a super small stl correctly

1.reason: input box limit the digit of input number, and has a max value limit of scale

Change-Id: Ib6f36033ebc9d1621eb0c3359c67ff788518f528
This commit is contained in:
liz.li 2022-12-13 17:19:21 +08:00 committed by Lane.Wei
parent 5f5ffc8376
commit c832a03616
2 changed files with 10 additions and 16 deletions

View File

@ -4175,7 +4175,7 @@ bool ImGui::BBLInputScalar(const char *label, ImGuiDataType data_type, void *p_d
if (format == NULL) format = DataTypeGetInfo(data_type)->PrintFmt;
char buf[8];
char buf[64];
DataTypeFormatString(buf, IM_ARRAYSIZE(buf), data_type, p_data, format);
bool value_changed = false;

View File

@ -304,7 +304,12 @@ void GizmoObjectManipulation::change_scale_value(int axis, double value)
return;
Vec3d scale = m_cache.scale;
if (scale[axis] != 0 && std::abs(m_cache.size[axis] * value / scale[axis]) > MAX_NUM) {
scale[axis] *= MAX_NUM / m_cache.size[axis];
}
else {
scale(axis) = value;
}
this->do_scale(axis, scale);
@ -505,18 +510,6 @@ bool GizmoObjectManipulation::reset_button(ImGuiWrapper *imgui_wrapper, float ca
unit_size = std::max(nuit_max[i], unit_size);
}
for (int i = 0; i < 3; i++)
{
if (str == "scale") {
if (vec1[i] > 39062.46)vec1[i] = 39062.46;
if (vec2[i] > 9999.99)vec2[i] = 9999.99;
}
if (str == "move") {
if (vec1[i] > 9999.99)vec1[i] = 9999.99;
if (vec2[i] > 9999.99)vec2[i] = 9999.99;
}
}
return unit_size + 8.0;
}
@ -609,6 +602,7 @@ void GizmoObjectManipulation::do_render_move_window(ImGuiWrapper *imgui_wrapper,
for (int i = 0;i<display_position.size();i++)
{
if (display_position[i] > MAX_NUM)display_position[i] = MAX_NUM;
if (display_position[i] < -MAX_NUM)display_position[i] = -MAX_NUM;
}
m_buffered_position = display_position;
@ -842,6 +836,7 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
ImGui::BBLInputDouble(label_scale_values[0][2], &scale[2], 0.0f, 0.0f, "%.2f");
ImGui::SameLine(caption_max + (++index_unit) *unit_size + (++index) * space_size);
imgui_wrapper->text(_L("%"));
m_buffered_scale = scale;
if (m_show_clear_scale) {
ImGui::SameLine(caption_max + 3 * unit_size + 4 * space_size + end_text_size);
@ -878,9 +873,8 @@ void GizmoObjectManipulation::do_render_scale_input_window(ImGuiWrapper* imgui_w
for (int i = 0;i<display_size.size();i++)
{
if (display_size[i] > MAX_NUM || scale[i]> MAX_NUM)display_size[i] = MAX_NUM;
if (std::abs(display_size[i]) > MAX_NUM) display_size[i] = MAX_NUM;
}
m_buffered_scale = scale;
m_buffered_size = display_size;
int size_sel = update(current_active_id, "size", original_size, m_buffered_size);
ImGui::PopStyleVar(1);