From 5ddcea806b6761c2ec153705d19294a1e682300c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hejl?= Date: Tue, 9 Jan 2024 10:53:43 +0100 Subject: [PATCH] Add to GCodeGenerator::last_position only when it has an assigned value. This behavior was there for a long time, but it was uncovered when std::optional was used. --- src/libslic3r/GCode.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 5f8e5df2b5..ff7b341807 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2641,7 +2641,9 @@ void GCodeGenerator::set_origin(const Vec2d &pointf) { // if origin increases (goes towards right), last_pos decreases because it goes towards left const auto offset = Point::new_scale(m_origin - pointf); - *(this->last_position) += offset; + if (last_position.has_value()) + *(this->last_position) += offset; + m_wipe.offset_path(offset); m_origin = pointf; }