mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 21:15:52 +08:00
Gizmo measure - Show diameter of selected circles into imgui dialog
This commit is contained in:
parent
534d0353eb
commit
1ba8025702
@ -1789,10 +1789,23 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit
|
|||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
const ImGuiTableFlags flags = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersH;
|
const ImGuiTableFlags flags = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersH;
|
||||||
if (ImGui::BeginTable("Selection", 2, flags)) {
|
if (ImGui::BeginTable("Selection", 2, flags)) {
|
||||||
add_strings_row_to_table(*m_imgui, _u8L("Selection") + " 1:", ImGuiWrapper::to_ImVec4(SELECTED_1ST_COLOR), m_selected_features.first.feature.has_value() ?
|
auto format_item_text = [use_inches, &units](const SelectedFeatures::Item& item) {
|
||||||
m_selected_features.first.source : _u8L("None"), ImGuiWrapper::to_ImVec4(SELECTED_1ST_COLOR));
|
std::string txt = item.feature.has_value() ? item.source : _u8L("None");
|
||||||
add_strings_row_to_table(*m_imgui, _u8L("Selection") + " 2:", ImGuiWrapper::to_ImVec4(SELECTED_2ND_COLOR), m_selected_features.second.feature.has_value() ?
|
if (item.feature.has_value() && item.feature->get_type() == Measure::SurfaceFeatureType::Circle) {
|
||||||
m_selected_features.second.source : _u8L("None"), ImGuiWrapper::to_ImVec4(SELECTED_2ND_COLOR));
|
auto [center, radius, normal] = item.feature->get_circle();
|
||||||
|
const Vec3d on_circle = center + radius * Measure::get_orthogonal(normal, true);
|
||||||
|
radius = (on_circle - center).norm();
|
||||||
|
if (use_inches)
|
||||||
|
radius = ObjectManipulation::mm_to_in * radius;
|
||||||
|
txt += " (" + _u8L("Diameter:") + " " + format_double(2.0 * radius) + units + ")";
|
||||||
|
}
|
||||||
|
return txt;
|
||||||
|
};
|
||||||
|
|
||||||
|
add_strings_row_to_table(*m_imgui, _u8L("Selection") + " 1:", ImGuiWrapper::to_ImVec4(SELECTED_1ST_COLOR), format_item_text(m_selected_features.first),
|
||||||
|
ImGuiWrapper::to_ImVec4(SELECTED_1ST_COLOR));
|
||||||
|
add_strings_row_to_table(*m_imgui, _u8L("Selection") + " 2:", ImGuiWrapper::to_ImVec4(SELECTED_2ND_COLOR), format_item_text(m_selected_features.second),
|
||||||
|
ImGuiWrapper::to_ImVec4(SELECTED_2ND_COLOR));
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user