@@ -16,7 +16,7 @@ export type TimeAreaProps = CommonProp & {
16
16
} ;
17
17
18
18
/** 动画时间轴组件 */
19
- export const TimeArea : FC < TimeAreaProps > = ( { setCursor, hideCursor, scale, scaleWidth, scaleCount, scaleSplitCount, startLeft, scrollLeft, onClickTimeArea, getScaleRender } ) => {
19
+ export const TimeArea : FC < TimeAreaProps > = ( { setCursor, maxScaleCount , hideCursor, scale, scaleWidth, scaleCount, scaleSplitCount, startLeft, scrollLeft, onClickTimeArea, getScaleRender } ) => {
20
20
const gridRef = useRef < Grid > ( ) ;
21
21
/** 是否显示细分刻度 */
22
22
const showUnit = scaleSplitCount > 0 ;
@@ -73,10 +73,12 @@ export const TimeArea: FC<TimeAreaProps> = ({ setCursor, hideCursor, scale, scal
73
73
if ( hideCursor ) return ;
74
74
const rect = ( e . currentTarget as HTMLElement ) . getBoundingClientRect ( ) ;
75
75
const position = e . clientX - rect . x ;
76
+ const left = Math . max ( position + scrollLeft , startLeft ) ;
77
+ if ( left > maxScaleCount * scaleWidth + startLeft - scrollLeft ) return ;
76
78
77
- const time = parserPixelToTime ( Math . max ( position + scrollLeft , startLeft ) , { startLeft, scale, scaleWidth } ) ;
79
+ const time = parserPixelToTime ( left , { startLeft, scale, scaleWidth } ) ;
78
80
const result = onClickTimeArea && onClickTimeArea ( time , e ) ;
79
- if ( result === false ) return ; // 返回false时阻止设置时间
81
+ if ( result === false ) return ; // 返回false时阻止设置时间
80
82
setCursor ( { time } ) ;
81
83
} }
82
84
className = { prefix ( 'time-area-interact' ) }
0 commit comments