File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,7 @@ impl Shape for Display {
110110 let Some ( ( grid_width, grid_height) ) = painter. get_point ( self . width , 0.0 ) else {
111111 return
112112 } ;
113- let scale_x = grid_width / LIGHTHOUSE_COLS ;
114- let scale_y = grid_height / LIGHTHOUSE_ROWS ;
113+ let scale = ( grid_width / LIGHTHOUSE_COLS ) . min ( grid_height / LIGHTHOUSE_ROWS ) ;
115114
116115 for y in 0 ..LIGHTHOUSE_ROWS {
117116 for x in 0 ..LIGHTHOUSE_COLS {
@@ -120,9 +119,9 @@ impl Shape for Display {
120119 ( ( lh_color. red as u32 ) << 16 ) | ( lh_color. green as u32 ) << 8 | lh_color. blue as u32
121120 ) ;
122121
123- for dy in 0 ..scale_y . min ( grid_height - 1 ) {
124- for dx in 0 ..scale_x . min ( grid_width - 1 ) {
125- painter. paint ( x * scale_x + dx, y * scale_y + dy, tui_color) ;
122+ for dy in 0 ..scale . min ( grid_height - 1 ) {
123+ for dx in 0 ..scale . min ( grid_width - 1 ) {
124+ painter. paint ( x * scale + dx, y * scale + dy, tui_color) ;
126125 }
127126 }
128127 }
You can’t perform that action at this time.
0 commit comments