diff options
Diffstat (limited to 'src/dimension_indicator.rs')
| -rw-r--r-- | src/dimension_indicator.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dimension_indicator.rs b/src/dimension_indicator.rs index a08d22c..0ea96d3 100644 --- a/src/dimension_indicator.rs +++ b/src/dimension_indicator.rs @@ -10,13 +10,14 @@ pub struct DimensionIndicator { } impl DimensionIndicator { + #[allow(clippy::new_without_default)] pub fn new() -> Self { Self { length_lines: Vec::new(), } } - pub fn from_corner_points(corner_points: &Vec<Vec2<f32>>) -> Self { + pub fn from_corner_points(corner_points: &[Vec2<f32>]) -> Self { let mut this = Self::new(); this.update_dimensions(corner_points); @@ -76,7 +77,7 @@ impl DimensionIndicator { // Start with the direction of the line vector. let dir = *start - *end; // Calculate perpendicular vec and normalise. - dir.rotated_90_clockwise() / dir.len() + dir.rotated_90_clockwise() / dir.length() }; // To not have the line directly in the rect, move start and end outside a bit. @@ -112,7 +113,7 @@ impl DimensionIndicator { */ let text_pos = transform.point_m_to_px((*end + *start) / 2.) + line_normal * 20.; rld.draw_text( - &format!("{}m", &(*end - *start).len()), + &format!("{}m", &(*end - *start).length()), text_pos.x as i32, text_pos.y as i32, 20, |
