mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
fix slider
This commit is contained in:
parent
efe5583e8a
commit
f3e4016795
4 changed files with 19 additions and 23 deletions
|
@ -788,9 +788,7 @@ const GCodeViewer::Color GCodeViewer::Neutral_Color = { 0.25f, 0.25f, 0.25f, 1.0
|
||||||
GCodeViewer::GCodeViewer()
|
GCodeViewer::GCodeViewer()
|
||||||
{
|
{
|
||||||
m_moves_slider = new IMSlider(0, 0, 0, 100, wxSL_HORIZONTAL);
|
m_moves_slider = new IMSlider(0, 0, 0, 100, wxSL_HORIZONTAL);
|
||||||
m_moves_slider->set_scale(GCODE_VIEWER_SLIDER_SCALE);
|
|
||||||
m_layers_slider = new IMSlider(0, 0, 0, 100, wxSL_VERTICAL);
|
m_layers_slider = new IMSlider(0, 0, 0, 100, wxSL_VERTICAL);
|
||||||
m_layers_slider->set_scale(GCODE_VIEWER_SLIDER_SCALE);
|
|
||||||
m_extrusions.reset_role_visibility_flags();
|
m_extrusions.reset_role_visibility_flags();
|
||||||
|
|
||||||
// m_sequential_view.skip_invisible_moves = true;
|
// m_sequential_view.skip_invisible_moves = true;
|
||||||
|
@ -1296,7 +1294,7 @@ void GCodeViewer::render(int canvas_width, int canvas_height, int right_margin)
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS fixed bottom_margin for space to render horiz slider
|
//BBS fixed bottom_margin for space to render horiz slider
|
||||||
int bottom_margin = SLIDER_BOTTOM_MARGIN;
|
int bottom_margin = SLIDER_BOTTOM_MARGIN * GCODE_VIEWER_SLIDER_SCALE;
|
||||||
m_sequential_view.m_show_gcode_window =
|
m_sequential_view.m_show_gcode_window =
|
||||||
m_sequential_view.m_show_gcode_window ||
|
m_sequential_view.m_show_gcode_window ||
|
||||||
(m_sequential_view.current.last != m_sequential_view.endpoints.last && !m_no_render_path);
|
(m_sequential_view.current.last != m_sequential_view.endpoints.last && !m_no_render_path);
|
||||||
|
|
|
@ -29,8 +29,8 @@ class OpenGLManager;
|
||||||
static const float GCODE_VIEWER_SLIDER_SCALE = 0.6f;
|
static const float GCODE_VIEWER_SLIDER_SCALE = 0.6f;
|
||||||
static const float SLIDER_DEFAULT_RIGHT_MARGIN = 10.0f;
|
static const float SLIDER_DEFAULT_RIGHT_MARGIN = 10.0f;
|
||||||
static const float SLIDER_DEFAULT_BOTTOM_MARGIN = 10.0f;
|
static const float SLIDER_DEFAULT_BOTTOM_MARGIN = 10.0f;
|
||||||
static const float SLIDER_RIGHT_MARGIN = 124.0f * GCODE_VIEWER_SLIDER_SCALE;
|
static const float SLIDER_RIGHT_MARGIN = 124.0f;
|
||||||
static const float SLIDER_BOTTOM_MARGIN = 64.0f * GCODE_VIEWER_SLIDER_SCALE;
|
static const float SLIDER_BOTTOM_MARGIN = 64.0f;
|
||||||
class GCodeViewer
|
class GCodeViewer
|
||||||
{
|
{
|
||||||
using IBufferType = unsigned short;
|
using IBufferType = unsigned short;
|
||||||
|
|
|
@ -2029,8 +2029,9 @@ void GLCanvas3D::render(bool only_init)
|
||||||
float right_margin = SLIDER_DEFAULT_RIGHT_MARGIN;
|
float right_margin = SLIDER_DEFAULT_RIGHT_MARGIN;
|
||||||
float bottom_margin = SLIDER_DEFAULT_BOTTOM_MARGIN;
|
float bottom_margin = SLIDER_DEFAULT_BOTTOM_MARGIN;
|
||||||
if (m_canvas_type == ECanvasType::CanvasPreview) {
|
if (m_canvas_type == ECanvasType::CanvasPreview) {
|
||||||
right_margin = SLIDER_RIGHT_MARGIN;
|
const float scale_factor = get_scale();
|
||||||
bottom_margin = SLIDER_BOTTOM_MARGIN;
|
right_margin = SLIDER_RIGHT_MARGIN * scale_factor * GCODE_VIEWER_SLIDER_SCALE;
|
||||||
|
bottom_margin = SLIDER_BOTTOM_MARGIN * scale_factor * GCODE_VIEWER_SLIDER_SCALE;
|
||||||
}
|
}
|
||||||
wxGetApp().plater()->get_notification_manager()->render_notifications(*this, get_overlay_window_width(), bottom_margin, right_margin);
|
wxGetApp().plater()->get_notification_manager()->render_notifications(*this, get_overlay_window_width(), bottom_margin, right_margin);
|
||||||
}
|
}
|
||||||
|
@ -6871,7 +6872,8 @@ void GLCanvas3D::_render_objects(GLVolumeCollection::ERenderType type, bool with
|
||||||
//BBS: GUI refactor: add canvas size as parameters
|
//BBS: GUI refactor: add canvas size as parameters
|
||||||
void GLCanvas3D::_render_gcode(int canvas_width, int canvas_height)
|
void GLCanvas3D::_render_gcode(int canvas_width, int canvas_height)
|
||||||
{
|
{
|
||||||
m_gcode_viewer.render(canvas_width, canvas_height, SLIDER_RIGHT_MARGIN);
|
float scale_factor = get_scale() * GCODE_VIEWER_SLIDER_SCALE;
|
||||||
|
m_gcode_viewer.render(canvas_width, canvas_height, SLIDER_RIGHT_MARGIN * GCODE_VIEWER_SLIDER_SCALE);
|
||||||
IMSlider *layers_slider = m_gcode_viewer.get_layers_slider();
|
IMSlider *layers_slider = m_gcode_viewer.get_layers_slider();
|
||||||
IMSlider *moves_slider = m_gcode_viewer.get_moves_slider();
|
IMSlider *moves_slider = m_gcode_viewer.get_moves_slider();
|
||||||
|
|
||||||
|
@ -6940,21 +6942,17 @@ void GLCanvas3D::_render_selection_center() const
|
||||||
void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
void GLCanvas3D::_check_and_update_toolbar_icon_scale()
|
||||||
{
|
{
|
||||||
// Don't update a toolbar scale, when we are on a Preview
|
// Don't update a toolbar scale, when we are on a Preview
|
||||||
if (wxGetApp().plater()->is_preview_shown())
|
if (wxGetApp().plater()->is_preview_shown()) {
|
||||||
{
|
IMSlider *m_layers_slider = get_gcode_viewer().get_layers_slider();
|
||||||
|
IMSlider *m_moves_slider = get_gcode_viewer().get_moves_slider();
|
||||||
|
const float sc = get_scale();
|
||||||
|
|
||||||
#if ENABLE_RETINA_GL
|
m_layers_slider->set_scale(sc * GCODE_VIEWER_SLIDER_SCALE);
|
||||||
IMSlider* m_layers_slider = get_gcode_viewer().get_layers_slider();
|
m_moves_slider->set_scale(sc * GCODE_VIEWER_SLIDER_SCALE);
|
||||||
IMSlider* m_moves_slider = get_gcode_viewer().get_moves_slider();
|
|
||||||
const float sc = m_retina_helper->get_scale_factor();
|
|
||||||
m_layers_slider->set_scale(sc * m_layers_slider->m_scale);
|
|
||||||
m_moves_slider->set_scale(sc * m_layers_slider->m_scale);
|
|
||||||
m_gcode_viewer.set_scale(sc);
|
m_gcode_viewer.set_scale(sc);
|
||||||
|
|
||||||
auto* m_notification = wxGetApp().plater()->get_notification_manager();
|
auto *m_notification = wxGetApp().plater()->get_notification_manager();
|
||||||
m_notification->set_scale(sc);
|
m_notification->set_scale(sc);
|
||||||
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -478,12 +478,12 @@ bool IMSlider::horizontal_slider(const char* str_id, int* value, int v_min, int
|
||||||
ImGui::ItemSize(draw_region);
|
ImGui::ItemSize(draw_region);
|
||||||
|
|
||||||
const float handle_dummy_width = 10.0f * m_scale;
|
const float handle_dummy_width = 10.0f * m_scale;
|
||||||
const float text_right_dummy = 50.0f * scale;
|
const float text_right_dummy = 70.0f * scale * m_scale;
|
||||||
|
|
||||||
const float handle_radius = 12.0f * m_scale;
|
const float handle_radius = 12.0f * m_scale;
|
||||||
const float handle_border = 2.0f * m_scale;
|
const float handle_border = 2.0f * m_scale;
|
||||||
|
|
||||||
const float text_frame_rounding = 2.0f * scale;
|
const float text_frame_rounding = 2.0f * scale * m_scale;
|
||||||
const float text_start_offset = 8.0f * m_scale;
|
const float text_start_offset = 8.0f * m_scale;
|
||||||
const ImVec2 text_padding = ImVec2(5.0f, 2.0f) * m_scale;
|
const ImVec2 text_padding = ImVec2(5.0f, 2.0f) * m_scale;
|
||||||
const float triangle_offsets[3] = {-3.5f * m_scale, 3.5f * m_scale, -6.06f * m_scale};
|
const float triangle_offsets[3] = {-3.5f * m_scale, 3.5f * m_scale, -6.06f * m_scale};
|
||||||
|
@ -759,7 +759,7 @@ bool IMSlider::vertical_slider(const char* str_id, int* higher_value, int* lower
|
||||||
const ImRect draw_region(pos, pos + size);
|
const ImRect draw_region(pos, pos + size);
|
||||||
ImGui::ItemSize(draw_region);
|
ImGui::ItemSize(draw_region);
|
||||||
|
|
||||||
const float text_dummy_height = 30.0f * scale;
|
const float text_dummy_height = 60.0f * scale * m_scale;
|
||||||
|
|
||||||
const float handle_radius = 12.0f * m_scale;
|
const float handle_radius = 12.0f * m_scale;
|
||||||
const float handle_border = 2.0f * m_scale;
|
const float handle_border = 2.0f * m_scale;
|
||||||
|
@ -768,7 +768,7 @@ bool IMSlider::vertical_slider(const char* str_id, int* higher_value, int* lower
|
||||||
const float one_handle_offset = 26.0f * m_scale;
|
const float one_handle_offset = 26.0f * m_scale;
|
||||||
const float bar_width = 28.0f * m_scale;
|
const float bar_width = 28.0f * m_scale;
|
||||||
|
|
||||||
const float text_frame_rounding = 2.0f * scale;
|
const float text_frame_rounding = 2.0f * scale * m_scale;
|
||||||
const ImVec2 text_padding = ImVec2(5.0f, 2.0f) * m_scale;
|
const ImVec2 text_padding = ImVec2(5.0f, 2.0f) * m_scale;
|
||||||
const ImVec2 triangle_offsets[3] = {ImVec2(2.0f, 0.0f) * m_scale, ImVec2(0.0f, 8.0f) * m_scale, ImVec2(9.0f, 0.0f) * m_scale};
|
const ImVec2 triangle_offsets[3] = {ImVec2(2.0f, 0.0f) * m_scale, ImVec2(0.0f, 8.0f) * m_scale, ImVec2(9.0f, 0.0f) * m_scale};
|
||||||
ImVec2 text_content_size;
|
ImVec2 text_content_size;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue