Added code to allow to customize skipping invisible moves when moving horizontal slider thumb in preview

This commit is contained in:
enricoturri1966 2020-10-09 13:00:20 +02:00
parent 170fe23b46
commit 32436aea6f
2 changed files with 15 additions and 11 deletions

View file

@ -325,6 +325,7 @@ bool GCodeViewer::init()
set_toolpath_move_type_visible(EMoveType::Extrude, true); set_toolpath_move_type_visible(EMoveType::Extrude, true);
m_sequential_view.marker.init(); m_sequential_view.marker.init();
m_sequential_view.skip_invisible_moves = true;
std::array<int, 2> point_sizes; std::array<int, 2> point_sizes;
::glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_sizes.data()); ::glGetIntegerv(GL_ALIASED_POINT_SIZE_RANGE, point_sizes.data());
@ -515,18 +516,20 @@ void GCodeViewer::update_sequential_view_current(unsigned int first, unsigned in
unsigned int new_first = first; unsigned int new_first = first;
unsigned int new_last = last; unsigned int new_last = last;
while (!is_visible(new_first)) { if (m_sequential_view.skip_invisible_moves) {
if (first_diff > 0) while (!is_visible(new_first)) {
++new_first; if (first_diff > 0)
else ++new_first;
--new_first; else
} --new_first;
}
while (!is_visible(new_last)) { while (!is_visible(new_last)) {
if (last_diff > 0) if (last_diff > 0)
++new_last; ++new_last;
else else
--new_last; --new_last;
}
} }
m_sequential_view.current.first = new_first; m_sequential_view.current.first = new_first;

View file

@ -365,6 +365,7 @@ public:
size_t last{ 0 }; size_t last{ 0 };
}; };
bool skip_invisible_moves{ false };
Endpoints endpoints; Endpoints endpoints;
Endpoints current; Endpoints current;
Endpoints last_current; Endpoints last_current;