@@ -103,15 +103,21 @@ function assembleArrow(
103103 return `<div style="${ styleCss . join ( '' ) } "></div>` ;
104104}
105105
106- function assembleTransition ( duration : number , onlyFade ? : boolean ) : string {
106+ function assembleTransition ( duration : number , onlyFadeTransition : boolean , enableDisplayTransition : boolean ) : string {
107107 const transitionCurve = 'cubic-bezier(0.23,1,0.32,1)' ;
108- let transitionOption = ` ${ duration / 2 } s ${ transitionCurve } ` ;
109- let transitionText = `opacity${ transitionOption } ,visibility${ transitionOption } ` ;
110- if ( ! onlyFade ) {
108+ let transitionOption = '' ;
109+ let transitionText = '' ;
110+ if ( enableDisplayTransition ) {
111+ transitionOption = ` ${ duration / 2 } s ${ transitionCurve } ` ;
112+ transitionText = `opacity${ transitionOption } ,visibility${ transitionOption } ` ;
113+ }
114+ if ( ! onlyFadeTransition ) {
111115 transitionOption = ` ${ duration } s ${ transitionCurve } ` ;
112- transitionText += env . transformSupported
113- ? `,${ CSS_TRANSFORM_VENDOR } ${ transitionOption } `
114- : `,left${ transitionOption } ,top${ transitionOption } ` ;
116+ transitionText += ( transitionText . length ? ',' : '' ) + (
117+ env . transformSupported
118+ ? `${ CSS_TRANSFORM_VENDOR } ${ transitionOption } `
119+ : `,left${ transitionOption } ,top${ transitionOption } `
120+ ) ;
115121 }
116122
117123 return CSS_TRANSITION_VENDOR + ':' + transitionText ;
@@ -173,7 +179,12 @@ function assembleFont(textStyleModel: Model<TooltipOption['textStyle']>): string
173179 return cssText . join ( ';' ) ;
174180}
175181
176- function assembleCssText ( tooltipModel : Model < TooltipOption > , enableTransition ?: boolean , onlyFade ?: boolean ) {
182+ function assembleCssText (
183+ tooltipModel : Model < TooltipOption > ,
184+ enableTransition : boolean ,
185+ onlyFadeTransition : boolean ,
186+ enableDisplayTransition : boolean
187+ ) {
177188 const cssText : string [ ] = [ ] ;
178189 const transitionDuration = tooltipModel . get ( 'transitionDuration' ) ;
179190 const backgroundColor = tooltipModel . get ( 'backgroundColor' ) ;
@@ -187,7 +198,8 @@ function assembleCssText(tooltipModel: Model<TooltipOption>, enableTransition?:
187198
188199 cssText . push ( 'box-shadow:' + boxShadow ) ;
189200 // Animation transition. Do not animate when transitionDuration <= 0.
190- enableTransition && transitionDuration > 0 && cssText . push ( assembleTransition ( transitionDuration , onlyFade ) ) ;
201+ enableTransition && transitionDuration > 0
202+ && cssText . push ( assembleTransition ( transitionDuration , onlyFadeTransition , enableDisplayTransition ) ) ;
191203
192204 if ( backgroundColor ) {
193205 cssText . push ( 'background-color:' + backgroundColor ) ;
@@ -400,7 +412,7 @@ class TooltipHTMLContent {
400412 }
401413 else {
402414 style . cssText = gCssText
403- + assembleCssText ( tooltipModel , ! this . _firstShow , this . _longHide )
415+ + assembleCssText ( tooltipModel , ! this . _firstShow , this . _longHide , this . _enableDisplayTransition )
404416 // initial transform
405417 + assembleTransform ( styleCoord [ 0 ] , styleCoord [ 1 ] , true )
406418 + `border-color:${ convertToColorString ( nearPointColor ) } ;`
0 commit comments