From ae10bc70b5a873013f2668d3d08504661d1981ca Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Mon, 7 May 2018 21:26:07 -0500 Subject: [PATCH] Actually unscale instead of doing silly things. --- src/GUI/Plater/Plate2D.cpp | 13 ++++++++++--- src/GUI/Plater/Plate2D.hpp | 7 +------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/GUI/Plater/Plate2D.cpp b/src/GUI/Plater/Plate2D.cpp index 82d5fbf03..f79aff616 100644 --- a/src/GUI/Plater/Plate2D.cpp +++ b/src/GUI/Plater/Plate2D.cpp @@ -286,15 +286,22 @@ std::vector Plate2D::scaled_points_to_pixel(const Slic3r::Polygon& poly return this->scaled_points_to_pixel(Polyline(poly), unscale); } -std::vector Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale) { +std::vector Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& poly, bool _unscale) { std::vector result; for (const auto& pt : poly.points) { - const auto tmp {wxPoint(pt.x, pt.y)}; - result.push_back( (unscale ? unscaled_point_to_pixel(tmp) : tmp) ); + const auto x {_unscale ? Slic3r::unscale(pt.x) : pt.x}; + const auto y {_unscale ? Slic3r::unscale(pt.y) : pt.y}; + result.push_back(wxPoint(x, y)); } return result; } +wxPoint Plate2D::unscaled_point_to_pixel(const wxPoint& in) { + const auto& canvas_height {this->GetSize().GetHeight()}; + const auto& zero = this->bed_origin; + return wxPoint(in.x * this->scaling_factor + zero.x, + in.y * this->scaling_factor + (zero.y - canvas_height)); +} } } // Namespace Slic3r::GUI diff --git a/src/GUI/Plater/Plate2D.hpp b/src/GUI/Plater/Plate2D.hpp index 42ec6f786..2d5752d14 100644 --- a/src/GUI/Plater/Plate2D.hpp +++ b/src/GUI/Plater/Plate2D.hpp @@ -79,12 +79,7 @@ private: std::vector scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale); /// For a specific point, unscale it relative to the origin - wxPoint unscaled_point_to_pixel(const wxPoint& in) { - const auto& canvas_height {this->GetSize().GetHeight()}; - const auto& zero = this->bed_origin; - return wxPoint(in.x * this->scaling_factor + zero.x, - in.y * this->scaling_factor + (zero.y - canvas_height)); - } + wxPoint unscaled_point_to_pixel(const wxPoint& in); /// Read print bed size from config and calculate the scaled rendition of the bed given the draw canvas. void update_bed_size();