@@ -459,8 +459,7 @@ const CONTAINER_HEIGHT_PADDING = 6;
459
459
export class ContentHoverWidget extends ResizableContentWidget {
460
460
461
461
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 ) ;
464
463
465
464
private _visibleData : ContentHoverVisibleData | undefined ;
466
465
private _positionPreference : ContentWidgetPositionPreference | undefined ;
@@ -584,8 +583,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
584
583
}
585
584
586
585
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 ) ;
589
587
this . _setAdjustedHoverWidgetDimensions ( size ) ;
590
588
this . _resizableNode . layout ( size . height , size . width ) ;
591
589
this . _setResizableNodeMaxDimensions ( ) ;
@@ -658,8 +656,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
658
656
}
659
657
660
658
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 ) ;
663
661
const { fontSize, lineHeight } = this . _editor . getOption ( EditorOption . fontInfo ) ;
664
662
const contentsDomNode = this . _hover . contentsDomNode ;
665
663
contentsDomNode . style . fontSize = `${ fontSize } px` ;
@@ -685,8 +683,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
685
683
}
686
684
687
685
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 ) ;
690
688
this . _setContentsDomNodeMaxDimensions ( width , height ) ;
691
689
}
692
690
0 commit comments