11use crate :: consts:: COLOR_OVERLAY_GRAY_DARK ;
2- use glam:: { DVec2 , UVec2 , UVec3 } ;
2+ use glam:: { DVec2 , UVec2 , UVec3 } ;
33use graphene_std:: raster:: Color ;
44use std:: fmt;
55
@@ -247,22 +247,22 @@ impl Default for GridSnapping {
247247impl GridSnapping {
248248 // Double grid size until it takes up at least 10px.
249249 pub fn compute_rectangle_spacing ( mut size : DVec2 , major_interval : & UVec2 , navigation : & PTZ ) -> Option < DVec2 > {
250- let mut iterations = 0 ;
251- size = size. abs ( ) ;
252- while ( size. x * navigation. zoom ( ) < 10. ) || ( size. y * navigation. zoom ( ) < 10. ) {
253- if iterations > 100 {
254- return None ;
255- }
256- if size. x * navigation. zoom ( ) < 10. {
257- size. x *= if major_interval. x != 1 { major_interval. x as f64 } else { 2. } ;
258- }
259- if size. y * navigation. zoom ( ) < 10. {
260- size. y *= if major_interval. y != 1 { major_interval. y as f64 } else { 2. } ;
261- }
262- iterations += 1 ;
250+ let mut iterations = 0 ;
251+ size = size. abs ( ) ;
252+ while ( size. x * navigation. zoom ( ) < 10. ) || ( size. y * navigation. zoom ( ) < 10. ) {
253+ if iterations > 100 {
254+ return None ;
255+ }
256+ if size. x * navigation. zoom ( ) < 10. {
257+ size. x *= if major_interval. x != 1 { major_interval. x as f64 } else { 2. } ;
258+ }
259+ if size. y * navigation. zoom ( ) < 10. {
260+ size. y *= if major_interval. y != 1 { major_interval. y as f64 } else { 2. } ;
263261 }
264- Some ( size )
262+ iterations += 1 ;
265263 }
264+ Some ( size)
265+ }
266266
267267 // Double grid size until it takes up at least 10px.
268268 pub fn compute_isometric_multiplier ( length : f64 , divisor : f64 , navigation : & PTZ ) -> Option < f64 > {
@@ -280,11 +280,11 @@ impl GridSnapping {
280280 }
281281
282282 pub fn has_minor_lines ( & self ) -> bool {
283- match self . grid_type {
284- GridType :: Rectangular { .. } => self . rectangular_major_interval . x > 1 || self . rectangular_major_interval . y > 1 ,
285- GridType :: Isometric { .. } => self . isometric_major_interval . x > 1 || self . isometric_major_interval . z > 1 || self . isometric_major_interval . y > 1 ,
286- }
283+ match self . grid_type {
284+ GridType :: Rectangular { .. } => self . rectangular_major_interval . x > 1 || self . rectangular_major_interval . y > 1 ,
285+ GridType :: Isometric { .. } => self . isometric_major_interval . x > 1 || self . isometric_major_interval . z > 1 || self . isometric_major_interval . y > 1 ,
287286 }
287+ }
288288}
289289
290290#[ derive( Debug , Clone , Copy , PartialEq , Eq ) ]
0 commit comments