mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-29 04:53:15 +08:00
ENH:Optimize SVG display interface for mac
jira: none Change-Id: I7592a12442f86e4d4b5bd2c1426e3a327de42d45
This commit is contained in:
parent
4fadeab450
commit
4231da88fa
@ -1318,7 +1318,6 @@ void GLGizmoSVG::draw_window()
|
|||||||
return;
|
return;
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::Indent(m_gui_cfg->icon_width);
|
|
||||||
draw_depth();
|
draw_depth();
|
||||||
draw_size();
|
draw_size();
|
||||||
|
|
||||||
@ -1332,14 +1331,14 @@ void GLGizmoSVG::draw_window()
|
|||||||
draw_mirroring();
|
draw_mirroring();
|
||||||
//draw_face_the_camera();
|
//draw_face_the_camera();
|
||||||
|
|
||||||
ImGui::Unindent(m_gui_cfg->icon_width);
|
|
||||||
|
|
||||||
if (!m_volume->is_the_only_one_part()) {
|
if (!m_volume->is_the_only_one_part()) {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
draw_model_type();
|
draw_model_type();
|
||||||
}
|
}
|
||||||
if (!m_can_use_surface) {
|
if (!m_can_use_surface) {
|
||||||
m_imgui->text(_L("Tip:If you want to place svg file on another part surface,\nyou should select part first, and then drag svg file to the part surface."));
|
m_imgui->text_wrapped(_L("Tip:If you want to place svg file on another part surface,you should select part first, and then drag svg file to the part surface."),
|
||||||
|
m_gui_cfg->input_offset + m_gui_cfg->input_width + m_gui_cfg->icon_width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1355,16 +1354,22 @@ void GLGizmoSVG::draw_preview()
|
|||||||
|
|
||||||
if (m_texture.id != 0) {
|
if (m_texture.id != 0) {
|
||||||
ImTextureID id = (void *) static_cast<intptr_t>(m_texture.id);
|
ImTextureID id = (void *) static_cast<intptr_t>(m_texture.id);
|
||||||
|
unsigned window_width = static_cast<unsigned>(ImGui::GetWindowSize().x - 2 * ImGui::GetStyle().WindowPadding.x);
|
||||||
|
|
||||||
|
if (m_texture.width > window_width && window_width > 0) {
|
||||||
|
m_texture.width = window_width;
|
||||||
|
}
|
||||||
|
if (m_texture.height > m_texture.width) {
|
||||||
|
m_texture.height = m_texture.width;
|
||||||
|
}
|
||||||
ImVec2 s(m_texture.width, m_texture.height);
|
ImVec2 s(m_texture.width, m_texture.height);
|
||||||
|
|
||||||
std::optional<float> spacing;
|
//std::optional<float> spacing;
|
||||||
// is texture over full height?
|
// is texture over full height?
|
||||||
if (m_texture.height != m_gui_cfg->texture_max_size_px) {
|
/* if (m_texture.height != m_gui_cfg->texture_max_size_px) {
|
||||||
spacing = (m_gui_cfg->texture_max_size_px - m_texture.height) / 2.f;
|
spacing = (m_gui_cfg->texture_max_size_px - m_texture.height) / 2.f;
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + *spacing);
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + *spacing);
|
||||||
}
|
}*/
|
||||||
// is texture over full width?
|
|
||||||
unsigned window_width = static_cast<unsigned>(ImGui::GetWindowSize().x - 2 * ImGui::GetStyle().WindowPadding.x);
|
|
||||||
if (window_width > m_texture.width) {
|
if (window_width > m_texture.width) {
|
||||||
float space = (window_width - m_texture.width) / 2.f;
|
float space = (window_width - m_texture.width) / 2.f;
|
||||||
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + space);
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + space);
|
||||||
@ -1388,7 +1393,8 @@ void GLGizmoSVG::draw_preview()
|
|||||||
// ImGui::SetTooltip("%s", tooltip.c_str());
|
// ImGui::SetTooltip("%s", tooltip.c_str());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (spacing.has_value()) ImGui::SetCursorPosY(ImGui::GetCursorPosY() + *spacing);
|
/* if (spacing.has_value())
|
||||||
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + *spacing);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1654,16 +1660,12 @@ void GLGizmoSVG::draw_size()
|
|||||||
const MinMax<float> &minmax = use_inch ? limits.ui_size_in : limits.ui_size;
|
const MinMax<float> &minmax = use_inch ? limits.ui_size_in : limits.ui_size;
|
||||||
if (m_keep_ratio) {
|
if (m_keep_ratio) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << _u8L("width:") << std::setprecision(2) << std::fixed << width << (use_inch ? "in" : "mm");
|
ss << std::setprecision(2) << std::fixed << width << " x " << std::setprecision(2) << std::fixed << height << (use_inch ? "in" : "mm");
|
||||||
std::stringstream ss_height;
|
|
||||||
ss_height << _u8L("height:") << std::setprecision(2) << std::fixed << height << (use_inch ? "in" : "mm");
|
|
||||||
ImGui::SameLine(m_gui_cfg->input_offset);
|
ImGui::SameLine(m_gui_cfg->input_offset);
|
||||||
ImGui::SetNextItemWidth(m_gui_cfg->input_width);
|
ImGui::SetNextItemWidth(m_gui_cfg->input_width);
|
||||||
float height_text_size_x = ImGui::CalcTextSize(ss_height.str().c_str()).x;
|
|
||||||
|
|
||||||
// convert to float for slider
|
// convert to float for slider
|
||||||
float width_f = static_cast<float>(width);
|
float width_f = static_cast<float>(width);
|
||||||
if (m_imgui->slider_float("##width_size_slider", &width_f, minmax.min, ui_size_max, ss.str().c_str(), 1.f, false, _L("set width and height keep ratio with width"),false)) {
|
if (m_imgui->slider_float("##width_size_slider", &width_f, minmax.min, ui_size_max, ss.str().c_str(), 1.f, false, _L("set width and height keep ratio with width"))) {
|
||||||
double width_ratio = width_f / width;
|
double width_ratio = width_f / width;
|
||||||
if (is_valid_scale_ratio(width_ratio)) {
|
if (is_valid_scale_ratio(width_ratio)) {
|
||||||
m_scale_width = m_scale_width.value_or(1.f) * width_ratio;
|
m_scale_width = m_scale_width.value_or(1.f) * width_ratio;
|
||||||
@ -1671,9 +1673,6 @@ void GLGizmoSVG::draw_size()
|
|||||||
new_relative_scale = Vec3d(width_ratio, width_ratio, 1.);
|
new_relative_scale = Vec3d(width_ratio, width_ratio, 1.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::SetNextItemWidth(height_text_size_x);
|
|
||||||
m_imgui->text(ss_height.str());
|
|
||||||
if (m_imgui->get_last_slider_status().deactivated_after_edit)
|
if (m_imgui->get_last_slider_status().deactivated_after_edit)
|
||||||
make_snap = true; // only last change of slider make snap
|
make_snap = true; // only last change of slider make snap
|
||||||
} else {
|
} else {
|
||||||
@ -1972,7 +1971,7 @@ void GLGizmoSVG::draw_model_type()
|
|||||||
ModelVolumeType negative = ModelVolumeType::NEGATIVE_VOLUME;
|
ModelVolumeType negative = ModelVolumeType::NEGATIVE_VOLUME;
|
||||||
ModelVolumeType part = ModelVolumeType::MODEL_PART;
|
ModelVolumeType part = ModelVolumeType::MODEL_PART;
|
||||||
ModelVolumeType type = m_volume->type();
|
ModelVolumeType type = m_volume->type();
|
||||||
|
ImGui::SameLine(m_gui_cfg->input_offset);
|
||||||
// TRN EmbossOperation
|
// TRN EmbossOperation
|
||||||
ImGuiWrapper::push_radio_style();
|
ImGuiWrapper::push_radio_style();
|
||||||
if (ImGui::RadioButton(_u8L("Join").c_str(), type == part))
|
if (ImGui::RadioButton(_u8L("Join").c_str(), type == part))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user