@@ -459,8 +459,7 @@ const CONTAINER_HEIGHT_PADDING = 6;
459459export class ContentHoverWidget extends ResizableContentWidget {
460460
461461 public static ID = 'editor.contrib.resizableContentHoverWidget' ;
462- private static _lastHeight : number = 0 ;
463- private static _lastWidth : number = 0 ;
462+ private static _lastDimensions : dom . Dimension = new dom . Dimension ( 0 , 0 ) ;
464463
465464 private _visibleData : ContentHoverVisibleData | undefined ;
466465 private _positionPreference : ContentWidgetPositionPreference | undefined ;
@@ -584,8 +583,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
584583 }
585584
586585 protected override _resize ( size : dom . Dimension ) : void {
587- ContentHoverWidget . _lastHeight = size . height ;
588- ContentHoverWidget . _lastWidth = size . width ;
586+ ContentHoverWidget . _lastDimensions = new dom . Dimension ( size . width , size . height ) ;
589587 this . _setAdjustedHoverWidgetDimensions ( size ) ;
590588 this . _resizableNode . layout ( size . height , size . width ) ;
591589 this . _setResizableNodeMaxDimensions ( ) ;
@@ -658,8 +656,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
658656 }
659657
660658 private _layout ( ) : void {
661- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastHeight ) ;
662- const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastWidth ) ;
659+ const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastDimensions . height ) ;
660+ const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastDimensions . width ) ;
663661 const { fontSize, lineHeight } = this . _editor . getOption ( EditorOption . fontInfo ) ;
664662 const contentsDomNode = this . _hover . contentsDomNode ;
665663 contentsDomNode . style . fontSize = `${ fontSize } px` ;
@@ -685,8 +683,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
685683 }
686684
687685 private _updateContentsDomNodeMaxDimensions ( ) {
688- const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastWidth ) ;
689- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastHeight ) ;
686+ const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastDimensions . height ) ;
687+ const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastDimensions . width ) ;
690688 this . _setContentsDomNodeMaxDimensions ( width , height ) ;
691689 }
692690
0 commit comments