aboutsummaryrefslogtreecommitdiff
path: root/src/dimension_indicator.rs
diff options
context:
space:
mode:
authorMax Pernklau2020-11-29 21:28:39 +0100
committerGitHub2020-11-29 21:28:39 +0100
commit4f2eab931bed0ec86c6136e365ad3a1b3b8c4e87 (patch)
tree010339f867d90c2c6293ddd16c4151ec220c7b8e /src/dimension_indicator.rs
parent4d3ee44eb4892bd454a1289f7fed308f82ec6a3b (diff)
parent90db142588e1b78250dc9b266bae359cf9e22721 (diff)
downloadgraf_karto-4f2eab931bed0ec86c6136e365ad3a1b3b8c4e87.tar.gz
graf_karto-4f2eab931bed0ec86c6136e365ad3a1b3b8c4e87.zip
Merge branch 'master' into wall-join
Diffstat (limited to 'src/dimension_indicator.rs')
-rw-r--r--src/dimension_indicator.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dimension_indicator.rs b/src/dimension_indicator.rs
index 2eb3eee..cc12f0b 100644
--- a/src/dimension_indicator.rs
+++ b/src/dimension_indicator.rs
@@ -6,7 +6,7 @@ use raylib::ffi::Color;
pub struct DimensionIndicator {
/// The lines that are used to draw the Dimension Indicator. For a rectangle for instance these
/// would be two. One for width and one for height.
- length_lines: Vec<(Vec2<f32>, Vec2<f32>)>,
+ length_lines: Vec<(Vec2<f64>, Vec2<f64>)>,
}
impl DimensionIndicator {
@@ -17,7 +17,7 @@ impl DimensionIndicator {
}
}
- pub fn from_corner_points(corner_points: &[Vec2<f32>]) -> Self {
+ pub fn from_corner_points(corner_points: &[Vec2<f64>]) -> Self {
let mut this = Self::new();
this.update_dimensions(corner_points);
@@ -30,7 +30,7 @@ impl DimensionIndicator {
/// Update the dimensions by analysing a given set of points and adjusting the internal
/// (measured) dimensions.
- pub fn update_dimensions(&mut self, corner_points: &[Vec2<f32>]) {
+ pub fn update_dimensions(&mut self, corner_points: &[Vec2<f64>]) {
if corner_points.len() < 2 {
warn!("Cannot discern dimensions when not at least two points are given. The dimensions were not updated.");
return;
@@ -85,8 +85,8 @@ impl DimensionIndicator {
};
// To not have the line directly in the rect, move start and end outside a bit.
- let start_px = transform.point_m_to_px(*start) + line_normal * 10.;
- let end_px = transform.point_m_to_px(*end) + line_normal * 10.;
+ let start_px = transform.point_m_to_px(start) + line_normal * 10.;
+ let end_px = transform.point_m_to_px(end) + line_normal * 10.;
/* Draw the indicator line, with stubs at both ends. */
let line_colour = Color {
@@ -115,7 +115,7 @@ impl DimensionIndicator {
* It should be placed in the middle of the line, but not into the line directly, so it
* will be moved out by the normal.
*/
- let text_pos = transform.point_m_to_px((*end + *start) / 2.) + line_normal * 20.;
+ let text_pos = transform.point_m_to_px(&((*end + *start) / 2.)) + line_normal * 20.;
rld.draw_text(
&format!("{}m", &(*end - *start).length()),
text_pos.x as i32,