@@ -455,6 +455,7 @@ const CONTAINER_HEIGHT_PADDING = 6;
455
455
export class ContentHoverWidget extends ResizableContentWidget {
456
456
457
457
public static ID = 'editor.contrib.resizableContentHoverWidget' ;
458
+ private static _lastDimensions : dom . Dimension = new dom . Dimension ( 0 , 0 ) ;
458
459
459
460
private _visibleData : ContentHoverVisibleData | undefined ;
460
461
private _positionPreference : ContentWidgetPositionPreference | undefined ;
@@ -578,6 +579,7 @@ export class ContentHoverWidget extends ResizableContentWidget {
578
579
}
579
580
580
581
protected override _resize ( size : dom . Dimension ) : void {
582
+ ContentHoverWidget . _lastDimensions = new dom . Dimension ( size . width , size . height ) ;
581
583
this . _setAdjustedHoverWidgetDimensions ( size ) ;
582
584
this . _resizableNode . layout ( size . height , size . width ) ;
583
585
this . _setResizableNodeMaxDimensions ( ) ;
@@ -650,12 +652,13 @@ export class ContentHoverWidget extends ResizableContentWidget {
650
652
}
651
653
652
654
private _layout ( ) : void {
653
- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
655
+ const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastDimensions . height ) ;
656
+ const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastDimensions . width ) ;
654
657
const { fontSize, lineHeight } = this . _editor . getOption ( EditorOption . fontInfo ) ;
655
658
const contentsDomNode = this . _hover . contentsDomNode ;
656
659
contentsDomNode . style . fontSize = `${ fontSize } px` ;
657
660
contentsDomNode . style . lineHeight = `${ lineHeight / fontSize } ` ;
658
- this . _setContentsDomNodeMaxDimensions ( Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) , height ) ;
661
+ this . _setContentsDomNodeMaxDimensions ( width , height ) ;
659
662
}
660
663
661
664
private _updateFont ( ) : void {
@@ -676,8 +679,8 @@ export class ContentHoverWidget extends ResizableContentWidget {
676
679
}
677
680
678
681
private _updateContentsDomNodeMaxDimensions ( ) {
679
- const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 ) ;
680
- const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 ) ;
682
+ const height = Math . max ( this . _editor . getLayoutInfo ( ) . height / 4 , 250 , ContentHoverWidget . _lastDimensions . height ) ;
683
+ const width = Math . max ( this . _editor . getLayoutInfo ( ) . width * 0.66 , 500 , ContentHoverWidget . _lastDimensions . width ) ;
681
684
this . _setContentsDomNodeMaxDimensions ( width , height ) ;
682
685
}
683
686
0 commit comments