From 4c4b57dc24bc36b3091931c9dcc36f6b1894a017 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Fri, 27 Nov 2020 22:55:00 +0100 Subject: Change to f64 as the preferred floating point number --- src/dimension_indicator.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/dimension_indicator.rs') 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, Vec2)>, + length_lines: Vec<(Vec2, Vec2)>, } impl DimensionIndicator { @@ -17,7 +17,7 @@ impl DimensionIndicator { } } - pub fn from_corner_points(corner_points: &[Vec2]) -> Self { + pub fn from_corner_points(corner_points: &[Vec2]) -> 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]) { + pub fn update_dimensions(&mut self, corner_points: &[Vec2]) { 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, -- cgit v1.2.3-70-g09d2