From 1e99454602e52cc6e8f4264b0f22ec60355fb0af Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Mon, 13 May 2019 14:28:03 +0200 Subject: [PATCH] Hopefully fixed SLA dialog scaling issues on OSX --- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 6 +++--- src/slic3r/GUI/ImGuiWrapper.cpp | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 1d3600013..dd271a19d 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -839,7 +839,7 @@ RENDER_AGAIN: wxString text = _(L("Head diameter")) + ": "; m_imgui->text(text); - float slider_left = m_imgui->get_style_scaling() * (m_imgui->calc_text_size(text)).x + m_imgui->scaled(1.f); + float slider_left = m_imgui->calc_text_size(text).x + m_imgui->scaled(1.f); ImGui::SameLine(/*m_imgui->scaled(6.66f)*/slider_left); ImGui::PushItemWidth(/*m_imgui->scaled(8.33f)*/m_imgui->scaled(15.f) - slider_left); @@ -880,7 +880,7 @@ RENDER_AGAIN: else { // not in editing mode: wxString text1 = _(L("Minimal points distance")) + ": "; wxString text2 = _(L("Support points density")) + ": "; - float sliders_left = m_imgui->get_style_scaling() * std::max(m_imgui->calc_text_size(text1).x, m_imgui->calc_text_size(text2).x) + m_imgui->scaled(1.f); + float sliders_left = std::max(m_imgui->calc_text_size(text1).x, m_imgui->calc_text_size(text2).x) + m_imgui->scaled(1.f); m_imgui->text(text1); ImGui::SameLine(/*m_imgui->scaled(9.44f)*/sliders_left); ImGui::PushItemWidth(/*m_imgui->scaled(5.55f)*/m_imgui->scaled(15.f)-sliders_left); @@ -933,7 +933,7 @@ RENDER_AGAIN: m_imgui->text(""); wxString text1 = _(L("Clipping of view"))+ ": "; wxString text2 = _(L("Reset direction")); - float slider_left = m_imgui->get_style_scaling() * std::max(m_imgui->calc_text_size(text1).x, m_imgui->calc_text_size(text2).x) + m_imgui->scaled(1.5f); + float slider_left = std::max(m_imgui->calc_text_size(text1).x, m_imgui->calc_text_size(text2).x) + m_imgui->scaled(1.5f); if (m_clipping_plane_distance == 0.f) m_imgui->text(text1); else { diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 03c83cf51..8221a45cf 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -186,7 +186,14 @@ void ImGuiWrapper::render() ImVec2 ImGuiWrapper::calc_text_size(const wxString &text) { auto text_utf8 = into_u8(text); - return ImGui::CalcTextSize(text_utf8.c_str()); + ImVec2 size = ImGui::CalcTextSize(text_utf8.c_str()); + +#ifndef __APPLE__ + size.x *= m_style_scaling; + size.y *= m_style_scaling; +#endif + + return size; } void ImGuiWrapper::set_next_window_pos(float x, float y, int flag)