Hopefully fixed SLA dialog scaling issues on OSX

This commit is contained in:
Lukas Matena 2019-05-13 14:28:03 +02:00
parent 76c3da9aba
commit 1e99454602
2 changed files with 11 additions and 4 deletions

View file

@ -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 {

View file

@ -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)