@@ -395,10 +395,8 @@ export class GridRenderer {
395
395
const { ctx, thinLineWidth } = renderingContext ;
396
396
const visibleCols = this . getters . getSheetViewVisibleCols ( ) ;
397
397
const left = visibleCols [ 0 ] ;
398
- const right = visibleCols [ visibleCols . length - 1 ] ;
399
398
const visibleRows = this . getters . getSheetViewVisibleRows ( ) ;
400
399
const top = visibleRows [ 0 ] ;
401
- const bottom = visibleRows [ visibleRows . length - 1 ] ;
402
400
const { width, height } = this . getters . getSheetViewDimensionWithHeaders ( ) ;
403
401
const selection = this . getters . getSelectedZones ( ) ;
404
402
const selectedCols = getZonesCols ( selection ) ;
@@ -416,7 +414,7 @@ export class GridRenderer {
416
414
ctx . strokeStyle = "#333" ;
417
415
418
416
// Columns headers background
419
- for ( let col = left ; col <= right ; col ++ ) {
417
+ for ( const col of visibleCols ) {
420
418
const colZone = { left : col , right : col , top : 0 , bottom : numberOfRows - 1 } ;
421
419
const { x, width } = this . getters . getVisibleRect ( colZone ) ;
422
420
const isColActive = activeCols . has ( col ) ;
@@ -432,7 +430,7 @@ export class GridRenderer {
432
430
}
433
431
434
432
// Rows headers background
435
- for ( let row = top ; row <= bottom ; row ++ ) {
433
+ for ( const row of visibleRows ) {
436
434
const rowZone = { top : row , bottom : row , left : 0 , right : numberOfCols - 1 } ;
437
435
const { y, height } = this . getters . getVisibleRect ( rowZone ) ;
438
436
@@ -460,22 +458,22 @@ export class GridRenderer {
460
458
ctx . beginPath ( ) ;
461
459
462
460
// column text + separator
463
- for ( const i of visibleCols ) {
464
- const colSize = this . getters . getColSize ( sheetId , i ) ;
465
- const colName = numberToLetters ( i ) ;
466
- ctx . fillStyle = activeCols . has ( i ) ? "#fff" : TEXT_HEADER_COLOR ;
467
- let colStart = this . getHeaderOffset ( "COL" , left , i ) ;
461
+ for ( const col of visibleCols ) {
462
+ const colSize = this . getters . getColSize ( sheetId , col ) ;
463
+ const colName = numberToLetters ( col ) ;
464
+ ctx . fillStyle = activeCols . has ( col ) ? "#fff" : TEXT_HEADER_COLOR ;
465
+ let colStart = this . getHeaderOffset ( "COL" , left , col ) ;
468
466
ctx . fillText ( colName , colStart + colSize / 2 , HEADER_HEIGHT / 2 ) ;
469
467
ctx . moveTo ( colStart + colSize , 0 ) ;
470
468
ctx . lineTo ( colStart + colSize , HEADER_HEIGHT ) ;
471
469
}
472
470
// row text + separator
473
- for ( const i of visibleRows ) {
474
- const rowSize = this . getters . getRowSize ( sheetId , i ) ;
475
- ctx . fillStyle = activeRows . has ( i ) ? "#fff" : TEXT_HEADER_COLOR ;
471
+ for ( const row of visibleRows ) {
472
+ const rowSize = this . getters . getRowSize ( sheetId , row ) ;
473
+ ctx . fillStyle = activeRows . has ( row ) ? "#fff" : TEXT_HEADER_COLOR ;
476
474
477
- let rowStart = this . getHeaderOffset ( "ROW" , top , i ) ;
478
- ctx . fillText ( String ( i + 1 ) , HEADER_WIDTH / 2 , rowStart + rowSize / 2 ) ;
475
+ let rowStart = this . getHeaderOffset ( "ROW" , top , row ) ;
476
+ ctx . fillText ( String ( row + 1 ) , HEADER_WIDTH / 2 , rowStart + rowSize / 2 ) ;
479
477
ctx . moveTo ( 0 , rowStart + rowSize ) ;
480
478
ctx . lineTo ( HEADER_WIDTH , rowStart + rowSize ) ;
481
479
}
0 commit comments