diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 703321c3ca..139ee5fa43 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1658,6 +1658,16 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, static const float orange[] = { 0.99f, 0.49f, 0.26f }; static const float gray[] = { 0.64f, 0.64f, 0.64f }; + const Size& cnv_size = get_canvas_size(); + unsigned int cnv_w = (unsigned int)cnv_size.get_width(); + unsigned int cnv_h = (unsigned int)cnv_size.get_height(); + if ((w > cnv_w) || (h > cnv_h)) + { + float ratio = std::min((float)cnv_w / (float)w, (float)cnv_h / (float)h); + w = (unsigned int)(ratio * (float)w); + h = (unsigned int)(ratio * (float)h); + } + thumbnail_data.set(w, h); GLVolumePtrs visible_volumes; @@ -1720,7 +1730,6 @@ void GLCanvas3D::render_thumbnail(ThumbnailData& thumbnail_data, unsigned int w, #endif // restore the framebuffer size to avoid flickering on the 3D scene - const Size& cnv_size = get_canvas_size(); m_camera.apply_viewport(0, 0, cnv_size.get_width(), cnv_size.get_height()); } #endif // ENABLE_THUMBNAIL_GENERATOR