@@ -459,6 +459,8 @@ 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
464
463
465
private _visibleData : ContentHoverVisibleData | undefined ;
464
466
private _positionPreference : ContentWidgetPositionPreference | undefined ;
@@ -582,6 +584,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
582
584
}
583
585
584
586
protected override _resize ( size : dom . Dimension ) : void {
587
+ ContentHoverWidget . _lastHeight = size . height ;
588
+ ContentHoverWidget . _lastWidth = size . width ;
585
589
this . _setAdjustedHoverWidgetDimensions ( size ) ;
586
590
this . _resizableNode . layout ( size . height , size . width ) ;
587
591
this . _setResizableNodeMaxDimensions ( ) ;
@@ -654,12 +658,13 @@ export class ContentHoverWidget extends ResizableContentWidget {
654
658
}
655
659
656
660
private _layout ( ) : void {
657
- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
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 ) ;
658
663
const { fontSize, lineHeight } = this . _editor . getOption ( EditorOption . fontInfo ) ;
659
664
const contentsDomNode = this . _hover . contentsDomNode ;
660
665
contentsDomNode . style . fontSize = `${ fontSize } px` ;
661
666
contentsDomNode . style . lineHeight = `${ lineHeight / fontSize } ` ;
662
- this . _setContentsDomNodeMaxDimensions ( Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) , height ) ;
667
+ this . _setContentsDomNodeMaxDimensions ( width , height ) ;
663
668
}
664
669
665
670
private _updateFont ( ) : void {
@@ -680,8 +685,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
680
685
}
681
686
682
687
private _updateContentsDomNodeMaxDimensions ( ) {
683
- const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) ;
684
- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
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 ) ;
685
690
this . _setContentsDomNodeMaxDimensions ( width , height ) ;
686
691
}
687
692
0 commit comments