diff --git a/src/slic3r/GUI/DoubleSliderForGcode.cpp b/src/slic3r/GUI/DoubleSliderForGcode.cpp index 7ad6c3bf81..6704f8d1c0 100644 --- a/src/slic3r/GUI/DoubleSliderForGcode.cpp +++ b/src/slic3r/GUI/DoubleSliderForGcode.cpp @@ -8,7 +8,7 @@ namespace DoubleSlider { static const float LEFT_MARGIN = 13.0f + 100.0f; // avoid thumbnail toolbar -static const float HORIZONTAL_SLIDER_HEIGHT = 45.0f; +static const float HORIZONTAL_SLIDER_HEIGHT = 40.0f; void DSForGcode::Render(const int canvas_width, const int canvas_height, float extra_scale/* = 0.1f*/, float offset/* = 0.f*/) { @@ -16,7 +16,7 @@ void DSForGcode::Render(const int canvas_width, const int canvas_height, float e return; m_scale = extra_scale * 0.1f * m_em; - ImVec2 pos = ImVec2{std::max(LEFT_MARGIN, 0.2f * canvas_width), canvas_height - 1.5f * HORIZONTAL_SLIDER_HEIGHT * m_scale}; + ImVec2 pos = ImVec2{std::max(LEFT_MARGIN, 0.2f * canvas_width), canvas_height - HORIZONTAL_SLIDER_HEIGHT * m_scale}; ImVec2 size = ImVec2(canvas_width - 2 * pos.x, HORIZONTAL_SLIDER_HEIGHT * m_scale); m_ctrl.Init(pos, size, m_scale); diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index d6188f3d92..fd94bbe57d 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -303,7 +303,11 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode if (viewer != nullptr) { ImGuiWrapper& imgui = *wxGetApp().imgui(); const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size(); - ImGuiPureWrap::set_next_window_pos(0.5f * static_cast(cnv_size.get_width()), static_cast(cnv_size.get_height()), ImGuiCond_Always, 0.5f, 1.0f); + + Preview* preview = dynamic_cast(wxGetApp().plater()->get_current_canvas3D()->get_wxglcanvas_parent()); + assert(preview); + + ImGuiPureWrap::set_next_window_pos(0.5f * static_cast(cnv_size.get_width()), static_cast(cnv_size.get_height() - preview->get_moves_slider_height()), ImGuiCond_Always, 0.5f, 1.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::SetNextWindowBgAlpha(0.25f); ImGuiPureWrap::begin(std::string("ToolPosition"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove); @@ -430,7 +434,7 @@ void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode if (table_shown) { static float table_wnd_height = 0.0f; const ImVec2 wnd_size = ImGui::GetWindowSize(); - ImGuiPureWrap::set_next_window_pos(ImGui::GetWindowPos().x + wnd_size.x, static_cast(cnv_size.get_height()), ImGuiCond_Always, 0.0f, 1.0f); + ImGuiPureWrap::set_next_window_pos(ImGui::GetWindowPos().x + wnd_size.x, static_cast(cnv_size.get_height() - preview->get_moves_slider_height()), ImGuiCond_Always, 0.0f, 1.0f); ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, wnd_size.y }); ImGuiPureWrap::begin(std::string("ToolPositionTableWnd"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove); diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 0348f811d9..1348564a4f 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1353,6 +1353,11 @@ void GLCanvas3D::post_event(wxEvent &&event) wxPostEvent(m_canvas, event); } +wxWindow* GLCanvas3D::get_wxglcanvas_parent() +{ + return m_canvas->GetParent(); +} + bool GLCanvas3D::init() { if (m_initialized) diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index ccc29d4b84..09ff631ed5 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -689,6 +689,8 @@ public: wxGLCanvas* get_wxglcanvas() { return m_canvas; } const wxGLCanvas* get_wxglcanvas() const { return m_canvas; } + wxWindow* get_wxglcanvas_parent(); + bool init(); void post_event(wxEvent &&event); diff --git a/src/slic3r/GUI/ImGuiDoubleSlider.hpp b/src/slic3r/GUI/ImGuiDoubleSlider.hpp index 59493e8880..8c7cc49785 100644 --- a/src/slic3r/GUI/ImGuiDoubleSlider.hpp +++ b/src/slic3r/GUI/ImGuiDoubleSlider.hpp @@ -100,7 +100,7 @@ private: struct DrawOptions { float scale { 1.f }; // used for Retina on osx - ImVec2 dummy_sz() const { return ImVec2(24.0f, 22.0f) * scale; } + ImVec2 dummy_sz() const { return ImVec2(24.0f, 16.0f) * scale; } ImVec2 thumb_dummy_sz() const { return ImVec2(17.0f, 17.0f) * scale; } ImVec2 groove_sz() const { return ImVec2(4.0f, 4.0f) * scale; } ImVec2 draggable_region_sz()const { return ImVec2(20.0f, 19.0f) * scale; } diff --git a/src/slic3r/GUI/NotificationManager.cpp b/src/slic3r/GUI/NotificationManager.cpp index 2cbc89f577..006f631b91 100644 --- a/src/slic3r/GUI/NotificationManager.cpp +++ b/src/slic3r/GUI/NotificationManager.cpp @@ -176,8 +176,8 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init ImVec2 win_pos(1.0f * (float)cnv_size.get_width() - right_gap, 1.0f * (float)cnv_size.get_height() - m_top_y); if (wxGetApp().plater()->is_preview_shown()) { - if (Preview* preview = dynamic_cast(canvas.get_wxglcanvas()->GetParent())) { - win_pos.y -= 1.5f * preview->get_moves_slider_height(); + if (Preview* preview = dynamic_cast(canvas.get_wxglcanvas_parent())) { + win_pos.y -= preview->get_moves_slider_height(); win_pos.x -= preview->get_layers_slider_width(); } }