1- import { BBox , Group , IGroup , IShape } from '@antv/g-canvas' ;
1+ import { Group , IGroup , IShape } from '@antv/g-canvas' ;
22import { each } from 'lodash' ;
33import { getBorderPositionAndStyle } from 'src/utils/cell/cell' ;
44import { translateGroup } from '../utils' ;
5+ import { PanelBBox } from '../bbox/panelBBox' ;
56import { BaseHeader , BaseHeaderConfig } from './base' ;
67import { Node } from '@/facet/layout/node' ;
78import { SpreadSheet } from '@/sheet-type/index' ;
@@ -25,13 +26,13 @@ export class SeriesNumberHeader extends BaseHeader<BaseHeaderConfig> {
2526 */
2627
2728 public static getSeriesNumberHeader (
28- viewportBBox : BBox ,
29+ viewportBBox : PanelBBox ,
2930 seriesNumberWidth : number ,
3031 leafNodes : Node [ ] ,
3132 spreadsheet : SpreadSheet ,
3233 cornerWidth : number ,
3334 ) : SeriesNumberHeader {
34- const { width , height } = viewportBBox ;
35+ const { height , viewportHeight } = viewportBBox ;
3536 const seriesNodes : Node [ ] = [ ] ;
3637 const isHierarchyTreeType = spreadsheet . isHierarchyTreeType ( ) ;
3738 leafNodes . forEach ( ( node : Node ) : void => {
@@ -53,8 +54,8 @@ export class SeriesNumberHeader extends BaseHeader<BaseHeaderConfig> {
5354 return new SeriesNumberHeader ( {
5455 width : cornerWidth ,
5556 height,
56- viewportWidth : width ,
57- viewportHeight : height ,
57+ viewportWidth : cornerWidth ,
58+ viewportHeight : viewportHeight ,
5859 position : { x : 0 , y : viewportBBox . y } ,
5960 data : seriesNodes ,
6061 spreadsheet,
@@ -65,10 +66,21 @@ export class SeriesNumberHeader extends BaseHeader<BaseHeaderConfig> {
6566 super ( cfg ) ;
6667 }
6768
68- public clip ( ) : void { }
69+ public clip ( ) : void {
70+ const { width, viewportHeight, scrollY } = this . headerConfig ;
71+ this . setClip ( {
72+ type : 'rect' ,
73+ attrs : {
74+ x : 0 ,
75+ y : scrollY ,
76+ width,
77+ height : viewportHeight ,
78+ } ,
79+ } ) ;
80+ }
6981
7082 public layout ( ) {
71- const { data, scrollY, height , spreadsheet } = this . headerConfig ;
83+ const { data, scrollY, viewportHeight , spreadsheet } = this . headerConfig ;
7284 if ( spreadsheet . isPivotMode ) {
7385 // 添加矩形背景
7486 this . addBackGround ( ) ;
@@ -81,7 +93,7 @@ export class SeriesNumberHeader extends BaseHeader<BaseHeaderConfig> {
8193 y ,
8294 cellHeight ,
8395 scrollY ,
84- height ,
96+ viewportHeight ,
8597 ) ;
8698 if ( isHeaderCellInViewport ) {
8799 // 按需渲染:视窗内的才渲染
@@ -113,13 +125,13 @@ export class SeriesNumberHeader extends BaseHeader<BaseHeaderConfig> {
113125
114126 private addBackGround ( ) {
115127 const rowCellTheme = this . headerConfig . spreadsheet . theme . rowCell . cell ;
116- const { position, width, height } = this . headerConfig ;
128+ const { position, width, viewportHeight } = this . headerConfig ;
117129
118130 this . backgroundShape = renderRect ( this , {
119131 x : position . x ,
120132 y : - position . y ,
121133 width,
122- height,
134+ height : viewportHeight ,
123135 fill : rowCellTheme . backgroundColor ,
124136 stroke : 'transparent' ,
125137 opacity : rowCellTheme . backgroundColorOpacity ,
@@ -132,7 +144,7 @@ export class SeriesNumberHeader extends BaseHeader<BaseHeaderConfig> {
132144 x : position . x ,
133145 y : - position . y ,
134146 width,
135- height,
147+ height : viewportHeight ,
136148 } ,
137149 rowCellTheme ,
138150 ) ;
@@ -150,7 +162,7 @@ export class SeriesNumberHeader extends BaseHeader<BaseHeaderConfig> {
150162 }
151163
152164 private addText ( group : IGroup , cellData : ViewMeta ) {
153- const { scrollY, height } = this . headerConfig ;
165+ const { scrollY, viewportHeight : height } = this . headerConfig ;
154166 const rowCellTheme = this . headerConfig . spreadsheet . theme . rowCell ;
155167 const {
156168 label,
0 commit comments