@@ -5,19 +5,17 @@ import { setWidth } from '@js/core/utils/size';
55import CurrentTimeShader from './current_time_shader' ;
66
77class HorizontalCurrentTimeShader extends CurrentTimeShader {
8- renderShader ( ) : void {
9- const groupCount = this . workSpace . isHorizontalGroupedWorkSpace ( )
10- ? this . workSpace . getGroupCount ( )
11- : 1 ;
8+ renderShader ( isHorizontalGroupedWorkSpace : boolean , groupCount : number , cellCount : number ) : void {
9+ const effectiveGroupCount = isHorizontalGroupedWorkSpace ? groupCount : 1 ;
1210
13- for ( let i = 0 ; i < groupCount ; i += 1 ) {
11+ for ( let i = 0 ; i < effectiveGroupCount ; i += 1 ) {
1412 const isFirstShader = i === 0 ;
1513 const $shader = isFirstShader ? this . $shader : this . createShader ( ) ;
1614
1715 if ( this . workSpace . isGroupedByDate ( ) ) {
18- this . customizeGroupedByDateShader ( $shader , i ) ;
16+ this . customizeGroupedByDateShader ( $shader , i , groupCount , cellCount ) ;
1917 } else {
20- this . customizeShader ( $shader , i ) ;
18+ this . customizeShader ( $shader , i , cellCount ) ;
2119 }
2220
2321 if ( ! isFirstShader ) {
@@ -26,15 +24,19 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader {
2624 }
2725 }
2826
29- private customizeShader ( $shader : dxElementWrapper , groupIndex : number ) : void {
27+ private customizeShader (
28+ $shader : dxElementWrapper ,
29+ groupIndex : number ,
30+ dateTableCellCount : number ,
31+ ) : void {
3032 // @ts -expect-error
3133 const shaderWidth = this . workSpace . getIndicationWidth ( ) as number ;
3234
3335 this . applyShaderWidth ( $shader , shaderWidth ) ;
3436
3537 if ( groupIndex >= 1 ) {
3638 const { workSpace } = this ;
37- const indicationWidth = workSpace . getCellCount ( ) * workSpace . getCellWidth ( ) ;
39+ const indicationWidth = dateTableCellCount * workSpace . getCellWidth ( ) ;
3840 $shader . css ( 'left' , indicationWidth ) ;
3941 } else {
4042 $shader . css ( 'left' , 0 ) ;
@@ -48,11 +50,16 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader {
4850 }
4951 }
5052
51- private customizeGroupedByDateShader ( $shader : dxElementWrapper , groupIndex : number ) : void {
53+ private customizeGroupedByDateShader (
54+ $shader : dxElementWrapper ,
55+ groupIndex : number ,
56+ shaderGroupCount : number ,
57+ dateTableCellCount : number ,
58+ ) : void {
5259 // @ts -expect-error
53- const cellCount = this . workSpace . getIndicationCellCount ( ) as number ;
54- const integerPart = Math . floor ( cellCount ) ;
55- const fractionPart = cellCount - integerPart ;
60+ const indicationCellCount = this . workSpace . getIndicationCellCount ( ) as number ;
61+ const integerPart = Math . floor ( indicationCellCount ) ;
62+ const fractionPart = indicationCellCount - integerPart ;
5663 const isFirstShaderPart = groupIndex === 0 ;
5764 const { workSpace } = this ;
5865 const shaderWidth = isFirstShaderPart
@@ -64,9 +71,9 @@ class HorizontalCurrentTimeShader extends CurrentTimeShader {
6471 this . applyShaderWidth ( $shader , shaderWidth ) ;
6572
6673 if ( isFirstShaderPart ) {
67- shaderLeft = workSpace . getCellCount ( ) * workSpace . getCellWidth ( ) * groupIndex ;
74+ shaderLeft = dateTableCellCount * workSpace . getCellWidth ( ) * groupIndex ;
6875 } else {
69- shaderLeft = workSpace . getCellWidth ( ) * integerPart * workSpace . getGroupCount ( )
76+ shaderLeft = workSpace . getCellWidth ( ) * integerPart * shaderGroupCount
7077 + groupIndex * workSpace . getCellWidth ( ) ;
7178 }
7279
0 commit comments