diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index cfb7d3dce..801ad3d98 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -341,6 +341,7 @@ void GLCanvas3D::Camera::set_scene_box(const BoundingBoxf3& box, GLCanvas3D& can GLCanvas3D::Bed::Bed() : m_type(Custom) + , m_scale_factor(1.0f) { } @@ -403,8 +404,10 @@ Point GLCanvas3D::Bed::point_projection(const Point& point) const } #if ENABLE_PRINT_BED_MODELS -void GLCanvas3D::Bed::render(float theta, bool useVBOs) const +void GLCanvas3D::Bed::render(float theta, bool useVBOs, float scale_factor) const { + m_scale_factor = scale_factor; + switch (m_type) { case MK2: @@ -431,8 +434,10 @@ void GLCanvas3D::Bed::render(float theta, bool useVBOs) const } } #else -void GLCanvas3D::Bed::render(float theta) const +void GLCanvas3D::Bed::render(float theta, float scale_factor) const { + m_scale_factor = scale_factor; + switch (m_type) { case MK2: @@ -686,7 +691,7 @@ void GLCanvas3D::Bed::_render_custom() const // we need depth test for grid, otherwise it would disappear when looking the object from below ::glEnable(GL_DEPTH_TEST); - ::glLineWidth(3.0f); + ::glLineWidth(3.0f * m_scale_factor); ::glColor4f(0.2f, 0.2f, 0.2f, 0.4f); ::glVertexPointer(3, GL_FLOAT, 0, (GLvoid*)m_gridlines.get_vertices()); ::glDrawArrays(GL_LINES, 0, (GLsizei)gridlines_vcount); @@ -1368,6 +1373,7 @@ GLCanvas3D::Selection::Selection() , m_valid(false) , m_bounding_box_dirty(true) , m_curved_arrow(16) + , m_scale_factor(1.0f) { #if ENABLE_RENDER_SELECTION_CENTER m_quadric = ::gluNewQuadric(); @@ -2166,11 +2172,13 @@ void GLCanvas3D::Selection::erase() } } -void GLCanvas3D::Selection::render() const +void GLCanvas3D::Selection::render(float scale_factor) const { if (!m_valid || is_empty()) return; + m_scale_factor = scale_factor; + // render cumulative bounding box of selected volumes _render_selected_volumes(); _render_synchronized_volumes(); @@ -2617,7 +2625,7 @@ void GLCanvas3D::Selection::_render_bounding_box(const BoundingBoxf3& box, float ::glEnable(GL_DEPTH_TEST); ::glColor3fv(color); - ::glLineWidth(2.0f); + ::glLineWidth(2.0f * m_scale_factor); ::glBegin(GL_LINES); @@ -5355,7 +5363,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) wxGetApp().obj_manipul()->update_settings_value(m_selection); // forces a frame render to update the view before the context menu is shown render(); - post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, pos.cast())); + + Vec2d logical_pos = pos.cast(); +#if ENABLE_RETINA_GL + const float factor = m_retina_helper->get_scale_factor(); + logical_pos = logical_pos.cwiseQuotient(Vec2d(factor, factor)); +#endif + post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, logical_pos)); } } } @@ -6404,10 +6418,15 @@ void GLCanvas3D::_render_background() const void GLCanvas3D::_render_bed(float theta) const { + float scale_factor = 1.0; +#if ENABLE_RETINA_GL + scale_factor = m_retina_helper->get_scale_factor(); +#endif + #if ENABLE_PRINT_BED_MODELS - m_bed.render(theta, m_use_VBOs); + m_bed.render(theta, m_use_VBOs, scale_factor); #else - m_bed.render(theta); + m_bed.render(theta, scale_factor); #endif // ENABLE_PRINT_BED_MODELS } @@ -6514,8 +6533,13 @@ void GLCanvas3D::_render_objects() const void GLCanvas3D::_render_selection() const { + float scale_factor = 1.0; +#if ENABLE_RETINA_GL + scale_factor = m_retina_helper->get_scale_factor(); +#endif + if (!m_gizmos.is_running()) - m_selection.render(); + m_selection.render(scale_factor); } #if ENABLE_RENDER_SELECTION_CENTER diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 0f998276d..e80189cce 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -222,6 +222,8 @@ class GLCanvas3D mutable GLBed m_model; #endif // ENABLE_PRINT_BED_MODELS + mutable float m_scale_factor; + public: Bed(); @@ -237,9 +239,9 @@ class GLCanvas3D Point point_projection(const Point& point) const; #if ENABLE_PRINT_BED_MODELS - void render(float theta, bool useVBOs) const; + void render(float theta, bool useVBOs, float scale_factor) const; #else - void render(float theta) const; + void render(float theta, float scale_factor) const; #endif // ENABLE_PRINT_BED_MODELS private: @@ -557,6 +559,8 @@ public: mutable GLCurvedArrow m_curved_arrow; #endif // ENABLE_SIDEBAR_VISUAL_HINTS + mutable float m_scale_factor; + public: Selection(); #if ENABLE_RENDER_SELECTION_CENTER @@ -640,7 +644,7 @@ public: void erase(); - void render() const; + void render(float scale_factor = 1.0) const; #if ENABLE_RENDER_SELECTION_CENTER void render_center() const; #endif // ENABLE_RENDER_SELECTION_CENTER diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 2f231b2e1..e36a68eda 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -96,6 +96,7 @@ void ImGuiWrapper::render() void ImGuiWrapper::set_next_window_pos(float x, float y, int flag) { ImGui::SetNextWindowPos(ImVec2(x, y), (ImGuiCond)flag); + ImGui::SetNextWindowSize(ImVec2(0.0, 0.0)); } void ImGuiWrapper::set_next_window_bg_alpha(float alpha)