mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 18:10:40 +08:00
Actually unscale instead of doing silly things.
This commit is contained in:
parent
bb9ce8dd6f
commit
e880d9d3ee
@ -286,15 +286,22 @@ std::vector<wxPoint> Plate2D::scaled_points_to_pixel(const Slic3r::Polygon& poly
|
|||||||
return this->scaled_points_to_pixel(Polyline(poly), unscale);
|
return this->scaled_points_to_pixel(Polyline(poly), unscale);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<wxPoint> Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale) {
|
std::vector<wxPoint> Plate2D::scaled_points_to_pixel(const Slic3r::Polyline& poly, bool _unscale) {
|
||||||
std::vector<wxPoint> result;
|
std::vector<wxPoint> result;
|
||||||
for (const auto& pt : poly.points) {
|
for (const auto& pt : poly.points) {
|
||||||
const auto tmp {wxPoint(pt.x, pt.y)};
|
const auto x {_unscale ? Slic3r::unscale(pt.x) : pt.x};
|
||||||
result.push_back( (unscale ? unscaled_point_to_pixel(tmp) : tmp) );
|
const auto y {_unscale ? Slic3r::unscale(pt.y) : pt.y};
|
||||||
|
result.push_back(wxPoint(x, y));
|
||||||
}
|
}
|
||||||
return result;
|
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
|
} } // Namespace Slic3r::GUI
|
||||||
|
@ -79,12 +79,7 @@ private:
|
|||||||
std::vector<wxPoint> scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale);
|
std::vector<wxPoint> scaled_points_to_pixel(const Slic3r::Polyline& poly, bool unscale);
|
||||||
|
|
||||||
/// For a specific point, unscale it relative to the origin
|
/// For a specific point, unscale it relative to the origin
|
||||||
wxPoint unscaled_point_to_pixel(const wxPoint& in) {
|
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Read print bed size from config and calculate the scaled rendition of the bed given the draw canvas.
|
/// Read print bed size from config and calculate the scaled rendition of the bed given the draw canvas.
|
||||||
void update_bed_size();
|
void update_bed_size();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user