Fix maths used for converting between model coordinates and pixels (and vice-versa)

This commit is contained in:
Joseph Lenox 2018-05-08 23:12:15 -05:00 committed by Joseph Lenox
parent 062e0fa7dc
commit 3ff475d02b
2 changed files with 2 additions and 2 deletions

View File

@ -348,7 +348,7 @@ wxPoint Plate2D::unscaled_point_to_pixel(const wxPoint& in) {
const auto& zero = this->bed_origin; const auto& zero = this->bed_origin;
return wxPoint( return wxPoint(
in.x * this->scaling_factor + zero.x, in.x * this->scaling_factor + zero.x,
in.y * this->scaling_factor + (zero.y - canvas_height)); canvas_height - in.y * this->scaling_factor + (zero.y - canvas_height));
} }

View File

@ -120,7 +120,7 @@ private:
const auto& zero {this->bed_origin}; const auto& zero {this->bed_origin};
return Slic3r::Point( return Slic3r::Point(
scale_(x - zero.x) / this->scaling_factor, scale_(x - zero.x) / this->scaling_factor,
scale_(y - zero.y) / this->scaling_factor scale_(zero.y - y) / this->scaling_factor
); );
} }
Slic3r::Point point_to_model_units(const wxPoint& pt) { Slic3r::Point point_to_model_units(const wxPoint& pt) {