diff options
| author | Arne Dußin | 2020-11-27 22:55:00 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-11-27 22:55:00 +0100 |
| commit | 4c4b57dc24bc36b3091931c9dcc36f6b1894a017 (patch) | |
| tree | 83f835eb850f249eff2e7694707464c9d4713a69 /src/dimension_indicator.rs | |
| parent | 99e935b63bb023cfd46c8f3d81074d3faf7ce592 (diff) | |
| download | graf_karto-4c4b57dc24bc36b3091931c9dcc36f6b1894a017.tar.gz graf_karto-4c4b57dc24bc36b3091931c9dcc36f6b1894a017.zip | |
Change to f64 as the preferred floating point number
Diffstat (limited to 'src/dimension_indicator.rs')
| -rw-r--r-- | src/dimension_indicator.rs | 12 |
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, |
