mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 21:45:58 +08:00
Merge branch 'ys_spe2277'
This commit is contained in:
commit
69bb0d87e7
@ -534,6 +534,10 @@ void Preview::create_sliders()
|
|||||||
// m_canvas_widget
|
// m_canvas_widget
|
||||||
m_canvas_widget->Bind(wxEVT_KEY_DOWN, &Preview::update_sliders_from_canvas, this);
|
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);
|
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 <z-eps, z+eps>.
|
// Find an index of a value in a sorted vector, which is in <z-eps, z+eps>.
|
||||||
|
@ -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 line_width = 1.5f * m_draw_opts.scale;
|
||||||
const float radius = m_draw_opts.thumb_radius();
|
const float radius = m_draw_opts.thumb_radius();
|
||||||
const float line_offset = 0.5f * 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;
|
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, border_clr, hexagon_angle, rounding);
|
||||||
ImGuiPureWrap::draw_hexagon(center, radius - line_width, thumb_bg_clr, hexagon_angle);
|
ImGuiPureWrap::draw_hexagon(center, radius - line_width, thumb_bg_clr, hexagon_angle, rounding);
|
||||||
|
|
||||||
if (mark) {
|
if (mark) {
|
||||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||||
@ -413,12 +414,12 @@ void ImGuiControl::check_and_correct_thumbs(int* higher_pos, int* lower_pos)
|
|||||||
if (is_horizontal()) {
|
if (is_horizontal()) {
|
||||||
if (lower_thumb_center_pos + thumb_radius > higher_thumb_center_pos) {
|
if (lower_thumb_center_pos + thumb_radius > higher_thumb_center_pos) {
|
||||||
if (m_selection == ssHigher) {
|
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);
|
m_regions.higher_thumb.TranslateX(thumb_radius);
|
||||||
*lower_pos = *higher_pos;
|
*lower_pos = *higher_pos;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_regions.higher_thumb = m_regions.lower_thumb;
|
m_regions.lower_thumb = m_regions.higher_thumb;
|
||||||
m_regions.lower_thumb.TranslateX(-thumb_radius);
|
m_regions.lower_thumb.TranslateX(-thumb_radius);
|
||||||
*higher_pos = *lower_pos;
|
*higher_pos = *lower_pos;
|
||||||
}
|
}
|
||||||
@ -433,7 +434,7 @@ void ImGuiControl::check_and_correct_thumbs(int* higher_pos, int* lower_pos)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_regions.higher_thumb = m_regions.lower_thumb;
|
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;
|
*higher_pos = *lower_pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ bool combo(const std::string& label, const std::vector<std::string>& options, in
|
|||||||
return res;
|
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)
|
if ((col & IM_COL32_A_MASK) == 0)
|
||||||
return;
|
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_min = start_angle;
|
||||||
float a_max = start_angle + 2.f * IM_PI;
|
float a_max = start_angle + 2.f * IM_PI;
|
||||||
|
|
||||||
|
if (rounding <= 0) {
|
||||||
window->DrawList->PathArcTo(center, radius, a_min, a_max, 6);
|
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);
|
window->DrawList->PathFillConvex(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace ImGuiPureWrap
|
|||||||
// Use selection = -1 to not mark any option as selected
|
// Use selection = -1 to not mark any option as selected
|
||||||
bool combo(const std::string& label, const std::vector<std::string>& options, int& selection, ImGuiComboFlags flags = 0, float label_width = 0.0f, float item_width = 0.0f);
|
bool combo(const std::string& label, const std::vector<std::string>& 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 char* label);
|
||||||
void text(const std::string& label);
|
void text(const std::string& label);
|
||||||
|
@ -753,8 +753,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
q->Layout();
|
q->Layout();
|
||||||
|
|
||||||
set_current_panel(wxGetApp().is_editor() ? static_cast<wxPanel*>(view3D) : static_cast<wxPanel*>(preview));
|
set_current_panel(wxGetApp().is_editor() ? static_cast<wxPanel*>(view3D) : static_cast<wxPanel*>(preview));
|
||||||
if (wxGetApp().is_gcode_viewer())
|
|
||||||
preview->hide_layers_slider();
|
|
||||||
|
|
||||||
// updates camera type from .ini file
|
// updates camera type from .ini file
|
||||||
camera.enable_update_config_on_type_change(true);
|
camera.enable_update_config_on_type_change(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user