@@ -310,6 +310,11 @@ interface PostIniter {
310310 ( chart : EChartsType ) : void
311311}
312312
313+ const ecInner = modelUtil . makeInner < {
314+ // Using hoverLayer due to over hoverLayerThreshold.
315+ usingTHL : boolean ;
316+ } , ECharts > ( ) ;
317+
313318type EventMethodName = 'on' | 'off' ;
314319function createRegisterEventWithLowercaseECharts ( method : EventMethodName ) {
315320 return function ( this : ECharts , ...args : any ) : ECharts {
@@ -1638,7 +1643,7 @@ class ECharts extends Eventful<ECEventDefinition> {
16381643
16391644 const scheduler = ecIns . _scheduler ;
16401645
1641- scheduler . restorePipelines ( ecIns . _model ) ;
1646+ scheduler . restorePipelines ( ecIns . _zr , ecIns . _model ) ;
16421647 scheduler . prepareStageTasks ( ) ;
16431648
16441649 prepareView ( ecIns , true ) ;
@@ -2538,6 +2543,11 @@ class ECharts extends Eventful<ECEventDefinition> {
25382543
25392544 function updateHoverLayerStatus ( ecIns : ECharts , ecModel : GlobalModel ) : void {
25402545 const zr = ecIns . _zr ;
2546+
2547+ if ( zr . painter . type !== 'canvas' ) {
2548+ return ;
2549+ }
2550+
25412551 const storage = zr . storage ;
25422552 let elCount = 0 ;
25432553
@@ -2547,20 +2557,27 @@ class ECharts extends Eventful<ECEventDefinition> {
25472557 }
25482558 } ) ;
25492559
2550- if ( elCount > ecModel . get ( 'hoverLayerThreshold' ) && ! env . node && ! env . worker ) {
2560+ const inner = ecInner ( ecIns ) ;
2561+ const shouldUseHoverLayer = elCount > ecModel . get ( 'hoverLayerThreshold' ) && ! env . node && ! env . worker ;
2562+
2563+ if ( inner . usingTHL || shouldUseHoverLayer ) {
25512564 ecModel . eachSeries ( function ( seriesModel ) {
25522565 if ( seriesModel . preventUsingHoverLayer ) {
25532566 return ;
25542567 }
25552568 const chartView = ecIns . _chartsMap [ seriesModel . __viewId ] ;
25562569 if ( chartView . __alive ) {
25572570 chartView . eachRendered ( ( el : ECElement ) => {
2558- if ( el . states . emphasis ) {
2559- el . states . emphasis . hoverLayer = true ;
2571+ const emphasis = el . states . emphasis ;
2572+ if ( emphasis && emphasis . hoverLayer !== graphic . HOVER_LAYER_FOR_INCREMENTAL ) {
2573+ emphasis . hoverLayer = shouldUseHoverLayer
2574+ ? graphic . HOVER_LAYER_FROM_THRESHOLD
2575+ : graphic . HOVER_LAYER_NO ;
25602576 }
25612577 } ) ;
25622578 }
25632579 } ) ;
2580+ inner . usingTHL = shouldUseHoverLayer ;
25642581 }
25652582 } ;
25662583
@@ -2726,6 +2743,9 @@ class ECharts extends Eventful<ECEventDefinition> {
27262743 getECMainCycleVersion ( ) : number {
27272744 return ecIns [ EC_MAIN_CYCLE_VERSION_KEY ] ;
27282745 }
2746+ usingTHL ( ) : boolean {
2747+ return ecInner ( ecIns ) . usingTHL ;
2748+ }
27292749 } ) ( ecIns ) ;
27302750 } ;
27312751
0 commit comments