diff --git a/src/slic3r/GUI/GUI_Preview.cpp b/src/slic3r/GUI/GUI_Preview.cpp index bb773bf421..f097f51159 100644 --- a/src/slic3r/GUI/GUI_Preview.cpp +++ b/src/slic3r/GUI/GUI_Preview.cpp @@ -534,6 +534,10 @@ void Preview::create_sliders() // m_canvas_widget m_canvas_widget->Bind(wxEVT_KEY_DOWN, &Preview::update_sliders_from_canvas, this); m_canvas_widget->Bind(EVT_GLCANVAS_SLIDERS_MANIPULATION, &Preview::update_sliders_from_canvas, this); + + // Hide sliders from the very begibing. Visibility will be set later + m_layers_slider->Hide(); + m_moves_slider->Hide(); } // Find an index of a value in a sorted vector, which is in . diff --git a/src/slic3r/GUI/ImGuiDoubleSlider.cpp b/src/slic3r/GUI/ImGuiDoubleSlider.cpp index 39cbc78844..cae765852f 100644 --- a/src/slic3r/GUI/ImGuiDoubleSlider.cpp +++ b/src/slic3r/GUI/ImGuiDoubleSlider.cpp @@ -360,11 +360,12 @@ void ImGuiControl::draw_thumb(const ImVec2& center, bool mark/* = false*/) const float line_width = 1.5f * m_draw_opts.scale; const float radius = m_draw_opts.thumb_radius(); const float line_offset = 0.5f * radius; + const float rounding = 1.5f * m_draw_opts.rounding(); const float hexagon_angle = is_horizontal() ? 0.f : IM_PI * 0.5f; - ImGuiPureWrap::draw_hexagon(center, radius, border_clr, hexagon_angle); - ImGuiPureWrap::draw_hexagon(center, radius - line_width, thumb_bg_clr, hexagon_angle); + ImGuiPureWrap::draw_hexagon(center, radius, border_clr, hexagon_angle, rounding); + ImGuiPureWrap::draw_hexagon(center, radius - line_width, thumb_bg_clr, hexagon_angle, rounding); if (mark) { ImGuiWindow* window = ImGui::GetCurrentWindow(); @@ -413,12 +414,12 @@ void ImGuiControl::check_and_correct_thumbs(int* higher_pos, int* lower_pos) if (is_horizontal()) { if (lower_thumb_center_pos + thumb_radius > higher_thumb_center_pos) { if (m_selection == ssHigher) { - m_regions.lower_thumb = m_regions.higher_thumb; + m_regions.higher_thumb = m_regions.lower_thumb; m_regions.higher_thumb.TranslateX(thumb_radius); *lower_pos = *higher_pos; } else { - m_regions.higher_thumb = m_regions.lower_thumb; + m_regions.lower_thumb = m_regions.higher_thumb; m_regions.lower_thumb.TranslateX(-thumb_radius); *higher_pos = *lower_pos; } @@ -433,7 +434,7 @@ void ImGuiControl::check_and_correct_thumbs(int* higher_pos, int* lower_pos) } else { m_regions.higher_thumb = m_regions.lower_thumb; - m_regions.lower_thumb.TranslateY(-thumb_radius); + m_regions.higher_thumb.TranslateY(-thumb_radius); *higher_pos = *lower_pos; } } diff --git a/src/slic3r/GUI/ImGuiPureWrap.cpp b/src/slic3r/GUI/ImGuiPureWrap.cpp index 4b3111acd8..41ce243b1f 100644 --- a/src/slic3r/GUI/ImGuiPureWrap.cpp +++ b/src/slic3r/GUI/ImGuiPureWrap.cpp @@ -296,7 +296,7 @@ bool combo(const std::string& label, const std::vector& options, in return res; } -void draw_hexagon(const ImVec2& center, float radius, ImU32 col, float start_angle) +void draw_hexagon(const ImVec2& center, float radius, ImU32 col, float start_angle, float rounding) { if ((col & IM_COL32_A_MASK) == 0) return; @@ -306,7 +306,21 @@ void draw_hexagon(const ImVec2& center, float radius, ImU32 col, float start_ang float a_min = start_angle; float a_max = start_angle + 2.f * IM_PI; - window->DrawList->PathArcTo(center, radius, a_min, a_max, 6); + if (rounding <= 0) { + window->DrawList->PathArcTo(center, radius, a_min, a_max, 6); + } + else { + const float a_delta = IM_PI / 4.f; + radius -= rounding; + + for (int i = 0; i <= 6; i++) { + float a = a_min + ((float)i / (float)6) * (a_max - a_min); + if (a >= 2.f * IM_PI) + a -= 2.f * IM_PI; + ImVec2 pos = ImVec2(center.x + ImCos(a) * radius, center.y + ImSin(a) * radius); + window->DrawList->PathArcTo(pos, rounding, a - a_delta, a + a_delta, 5); + } + } window->DrawList->PathFillConvex(col); } diff --git a/src/slic3r/GUI/ImGuiPureWrap.hpp b/src/slic3r/GUI/ImGuiPureWrap.hpp index ab4eccab1b..ef1f04c8a5 100644 --- a/src/slic3r/GUI/ImGuiPureWrap.hpp +++ b/src/slic3r/GUI/ImGuiPureWrap.hpp @@ -53,7 +53,7 @@ namespace ImGuiPureWrap // Use selection = -1 to not mark any option as selected bool combo(const std::string& label, const std::vector& options, int& selection, ImGuiComboFlags flags = 0, float label_width = 0.0f, float item_width = 0.0f); - void draw_hexagon(const ImVec2& center, float radius, ImU32 col, float start_angle = 0.f); + void draw_hexagon(const ImVec2& center, float radius, ImU32 col, float start_angle = 0.f, float rounding = 0.f); void text(const char* label); void text(const std::string& label); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 8c41c88f94..a90e7c8bca 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -753,8 +753,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) q->Layout(); set_current_panel(wxGetApp().is_editor() ? static_cast(view3D) : static_cast(preview)); - if (wxGetApp().is_gcode_viewer()) - preview->hide_layers_slider(); // updates camera type from .ini file camera.enable_update_config_on_type_change(true);