Mac: Retina OpenGL: Fix ImGui font switch, dynamic switching, toolbar fixes

This commit is contained in:
Vojtech Kral 2019-01-24 13:16:46 +01:00
parent d1c569dd57
commit 3df1ed8f6b
7 changed files with 50 additions and 20 deletions

View file

@ -3952,11 +3952,6 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
#if ENABLE_RETINA_GL
m_retina_helper.reset(new RetinaHelper(canvas));
const bool use_retina = wxGetApp().app_config->get("use_retina_opengl") == "1";
BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Use Retina OpenGL: " << use_retina;
m_retina_helper->set_use_retina(use_retina);
BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Scaling factor: " << m_retina_helper->get_scale_factor();
#endif
}
@ -5947,6 +5942,26 @@ void GLCanvas3D::handle_sidebar_focus_event(const std::string& opt_key, bool foc
}
}
void GLCanvas3D::update_ui_from_settings()
{
#if ENABLE_RETINA_GL
const float orig_scaling = m_retina_helper->get_scale_factor();
const bool use_retina = wxGetApp().app_config->get("use_retina_opengl") == "1";
BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Use Retina OpenGL: " << use_retina;
m_retina_helper->set_use_retina(use_retina);
const float new_scaling = m_retina_helper->get_scale_factor();
if (new_scaling != orig_scaling) {
BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Scaling factor: " << new_scaling;
m_camera.zoom /= orig_scaling;
m_camera.zoom *= new_scaling;
_refresh_if_shown_on_screen();
}
#endif
}
bool GLCanvas3D::_is_shown_on_screen() const
{
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;