@@ -3,6 +3,7 @@ import type { IGroup } from '@antv/g-canvas';
33import { Group } from '@antv/g-canvas' ;
44import { renderLine } from 'src/utils/g-renders' ;
55import { GridInfo } from 'src/common/interface' ;
6+ import { KEY_GROUP_GRID_GROUP } from 'src/common/constant' ;
67
78export class GridGroup extends Group {
89 private ss : SpreadSheet ;
@@ -19,7 +20,7 @@ export class GridGroup extends Group {
1920 rows : [ ] ,
2021 } ;
2122
22- public updateGrid = ( gridInfo : GridInfo , id = 'foobar' ) => {
23+ public updateGrid = ( gridInfo : GridInfo , id = KEY_GROUP_GRID_GROUP ) => {
2324 const bbox = this . getBBox ( ) ;
2425 const style = this . ss . theme . dataCell . cell ;
2526
@@ -33,11 +34,12 @@ export class GridGroup extends Group {
3334
3435 this . gridInfo = gridInfo ;
3536 this . gridInfo . cols . forEach ( ( item ) => {
37+ const x = item - style . verticalBorderWidth / 2 ;
3638 renderLine (
3739 this . gridGroup as Group ,
3840 {
39- x1 : item - style . verticalBorderWidth / 2 ,
40- x2 : item - style . verticalBorderWidth / 2 ,
41+ x1 : x ,
42+ x2 : x ,
4143 y1 : Math . ceil ( bbox . minY ) ,
4244 y2 : Math . floor ( bbox . maxY ) ,
4345 } ,
@@ -50,13 +52,14 @@ export class GridGroup extends Group {
5052 } ) ;
5153
5254 this . gridInfo . rows . forEach ( ( item ) => {
55+ const y = item - style . horizontalBorderWidth / 2 ;
5356 renderLine (
5457 this . gridGroup as Group ,
5558 {
5659 x1 : Math . ceil ( bbox . minX ) ,
5760 x2 : Math . floor ( bbox . maxX ) ,
58- y1 : item - style . verticalBorderWidth / 2 ,
59- y2 : item - style . verticalBorderWidth / 2 ,
61+ y1 : y ,
62+ y2 : y ,
6063 } ,
6164 {
6265 stroke : style . horizontalBorderColor ,
0 commit comments