@@ -21,39 +21,32 @@ abstract class ResizableContentWidget extends Disposable implements IContentWidg
21
21
readonly allowEditorOverflow : boolean = true ;
22
22
readonly suppressMouseDown : boolean = false ;
23
23
24
- protected readonly _contentNode : HTMLDivElement ;
25
24
protected readonly _resizableNode = this . _register ( new ResizableHTMLElement ( ) ) ;
26
25
protected _contentPosition : IContentWidgetPosition | null = null ;
27
26
28
- private _resizing : boolean = false ;
27
+ private _isResizing : boolean = false ;
29
28
30
29
constructor (
31
30
protected readonly _editor : ICodeEditor ,
32
31
_initialSize : dom . IDimension = new dom . Dimension ( 10 , 10 )
33
32
) {
34
33
super ( ) ;
35
- this . _contentNode = document . createElement ( 'div' ) ;
36
- this . _contentNode . style . width = `${ _initialSize . width } px` ;
37
- this . _contentNode . style . height = `${ _initialSize . height } px` ;
38
34
this . _resizableNode . domNode . style . position = 'absolute' ;
39
- this . _resizableNode . domNode . appendChild ( this . _contentNode ) ;
40
35
this . _resizableNode . minSize = new dom . Dimension ( 10 , 10 ) ;
41
36
this . _resizableNode . enableSashes ( true , true , true , true ) ;
42
37
this . _resizableNode . layout ( _initialSize . height , _initialSize . width ) ;
43
38
this . _register ( this . _resizableNode . onDidResize ( e => {
44
- this . _contentNode . style . width = `${ e . dimension . width } px` ;
45
- this . _contentNode . style . height = `${ e . dimension . height } px` ;
46
39
if ( e . done ) {
47
- this . _resizing = false ;
40
+ this . _isResizing = false ;
48
41
}
49
42
} ) ) ;
50
43
this . _register ( this . _resizableNode . onDidWillResize ( ( ) => {
51
- this . _resizing = true ;
44
+ this . _isResizing = true ;
52
45
} ) ) ;
53
46
}
54
47
55
- get resizing ( ) {
56
- return this . _resizing ;
48
+ get isResizing ( ) {
49
+ return this . _isResizing ;
57
50
}
58
51
59
52
abstract getId ( ) : string ;
@@ -68,11 +61,8 @@ abstract class ResizableContentWidget extends Disposable implements IContentWidg
68
61
69
62
protected _availableVerticalSpaceAbove ( position : IPosition ) : number | undefined {
70
63
const editorDomNode = this . _editor . getDomNode ( ) ;
71
- if ( ! editorDomNode ) {
72
- return ;
73
- }
74
64
const mouseBox = this . _editor . getScrolledVisiblePosition ( position ) ;
75
- if ( ! mouseBox ) {
65
+ if ( ! editorDomNode || ! mouseBox ) {
76
66
return ;
77
67
}
78
68
const editorBox = dom . getDomNodePagePosition ( editorDomNode ) ;
@@ -81,11 +71,8 @@ abstract class ResizableContentWidget extends Disposable implements IContentWidg
81
71
82
72
protected _availableVerticalSpaceBelow ( position : IPosition ) : number | undefined {
83
73
const editorDomNode = this . _editor . getDomNode ( ) ;
84
- if ( ! editorDomNode ) {
85
- return ;
86
- }
87
74
const mouseBox = this . _editor . getScrolledVisiblePosition ( position ) ;
88
- if ( ! mouseBox ) {
75
+ if ( ! editorDomNode || ! mouseBox ) {
89
76
return ;
90
77
}
91
78
const editorBox = dom . getDomNodePagePosition ( editorDomNode ) ;
@@ -94,7 +81,7 @@ abstract class ResizableContentWidget extends Disposable implements IContentWidg
94
81
return bodyBox . height - mouseBottom ;
95
82
}
96
83
97
- protected _findRenderingPreference ( widgetHeight : number , showAtPosition : IPosition ) : ContentWidgetPositionPreference | undefined {
84
+ protected _findPositionPreference ( widgetHeight : number , showAtPosition : IPosition ) : ContentWidgetPositionPreference | undefined {
98
85
const maxHeightBelow = Math . min ( this . _availableVerticalSpaceBelow ( showAtPosition ) ?? Infinity , widgetHeight ) ;
99
86
const maxHeightAbove = Math . min ( this . _availableVerticalSpaceAbove ( showAtPosition ) ?? Infinity , widgetHeight ) ;
100
87
const maxHeight = Math . min ( Math . max ( maxHeightAbove , maxHeightBelow ) , widgetHeight ) ;
0 commit comments