Tech ENABLE_PREVIEW_LAYOUT - Avoid resetting the preview's horizontal slider when toggling options

This commit is contained in:
enricoturri1966 2021-09-24 11:57:29 +02:00
parent 720fdf9bb3
commit 57a0b23a07
4 changed files with 26 additions and 1 deletions

View File

@ -712,14 +712,20 @@ void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std:
#endif // ENABLE_GCODE_VIEWER_STATISTICS
// update buffers' render paths
#if ENABLE_PREVIEW_LAYOUT
refresh_render_paths(false, false);
#else
refresh_render_paths();
#endif // ENABLE_PREVIEW_LAYOUT
log_memory_used("Refreshed G-code extrusion paths, ");
}
#if !ENABLE_PREVIEW_LAYOUT
void GCodeViewer::refresh_render_paths()
{
refresh_render_paths(false, false);
}
#endif // !ENABLE_PREVIEW_LAYOUT
void GCodeViewer::update_shells_color_by_extruder(const DynamicPrintConfig* config)
{
@ -4089,7 +4095,7 @@ void GCodeViewer::render_legend(float& legend_height)
unsigned int new_flags = set_flag(flags, flag, !active);
set_options_visibility_from_flags(new_flags);
wxGetApp().plater()->get_current_canvas3D()->refresh_gcode_preview_render_paths();
wxGetApp().plater()->get_current_canvas3D()->refresh_gcode_preview_render_paths(true, true);
wxGetApp().plater()->update_preview_moves_slider();
}

View File

@ -812,7 +812,11 @@ public:
void load(const GCodeProcessor::Result& gcode_result, const Print& print, bool initialized);
// recalculate ranges in dependence of what is visible and sets tool/print colors
void refresh(const GCodeProcessor::Result& gcode_result, const std::vector<std::string>& str_tool_colors);
#if ENABLE_PREVIEW_LAYOUT
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
#else
void refresh_render_paths();
#endif // ENABLE_PREVIEW_LAYOUT
void update_shells_color_by_extruder(const DynamicPrintConfig* config);
void reset();
@ -857,7 +861,9 @@ public:
private:
void load_toolpaths(const GCodeProcessor::Result& gcode_result);
void load_shells(const Print& print, bool initialized);
#if !ENABLE_PREVIEW_LAYOUT
void refresh_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last) const;
#endif // !ENABLE_PREVIEW_LAYOUT
void render_toolpaths();
void render_shells();
void render_legend(float& legend_height);

View File

@ -2100,12 +2100,21 @@ void GLCanvas3D::load_gcode_preview(const GCodeProcessor::Result& gcode_result,
request_extra_frame();
}
#if ENABLE_PREVIEW_LAYOUT
void GLCanvas3D::refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last)
{
m_gcode_viewer.refresh_render_paths(keep_sequential_current_first, keep_sequential_current_last);
set_as_dirty();
request_extra_frame();
}
#else
void GLCanvas3D::refresh_gcode_preview_render_paths()
{
m_gcode_viewer.refresh_render_paths();
set_as_dirty();
request_extra_frame();
}
#endif // ENABLE_PREVIEW_LAYOUT
void GLCanvas3D::load_sla_preview()
{

View File

@ -721,7 +721,11 @@ public:
void reload_scene(bool refresh_immediately, bool force_full_scene_refresh = false);
void load_gcode_preview(const GCodeProcessor::Result& gcode_result, const std::vector<std::string>& str_tool_colors);
#if ENABLE_PREVIEW_LAYOUT
void refresh_gcode_preview_render_paths(bool keep_sequential_current_first, bool keep_sequential_current_last);
#else
void refresh_gcode_preview_render_paths();
#endif // ENABLE_PREVIEW_LAYOUT
void set_gcode_view_preview_type(GCodeViewer::EViewType type) { return m_gcode_viewer.set_view_type(type); }
GCodeViewer::EViewType get_gcode_view_preview_type() const { return m_gcode_viewer.get_view_type(); }
void load_sla_preview();