@@ -45,6 +45,11 @@ const RESIZE_BAR_DOT_SPACING = 4;
45
45
const RESIZE_BAR_HEIGHT = 8 ;
46
46
const RESIZE_BAR_WITH_LABEL_HEIGHT = 16 ;
47
47
48
+ const HIDDEN_RECT = {
49
+ origin : { x : 0 , y : 0 } ,
50
+ size : { width : 0 , height : 0 } ,
51
+ } ;
52
+
48
53
class ResizeBar extends View {
49
54
_interactionState : ResizeBarState = 'normal' ;
50
55
_label : string ;
@@ -238,8 +243,6 @@ export class ResizableView extends View {
238
243
this . addSubview ( this . _subview ) ;
239
244
this . addSubview ( this . _resizeBar ) ;
240
245
241
- // TODO (ResizableView) Allow subviews to specify default sizes.
242
- // Maybe that or set some % based default so all panels are visible to begin with.
243
246
const subviewDesiredSize = subview . desiredSize ( ) ;
244
247
this . _updateLayoutStateAndResizeBar (
245
248
subviewDesiredSize . maxInitialHeight != null
@@ -253,14 +256,9 @@ export class ResizableView extends View {
253
256
254
257
desiredSize ( ) {
255
258
const resizeBarDesiredSize = this . _resizeBar . desiredSize ( ) ;
256
- const subviewDesiredSize = this . _subview . desiredSize ( ) ;
257
-
258
- const subviewDesiredWidth = subviewDesiredSize
259
- ? subviewDesiredSize . width
260
- : 0 ;
261
259
262
260
return {
263
- width : Math . max ( subviewDesiredWidth , resizeBarDesiredSize . width ) ,
261
+ width : this . frame . size . width ,
264
262
height : this . _layoutState . barOffsetY + resizeBarDesiredSize . height ,
265
263
} ;
266
264
}
@@ -315,19 +313,19 @@ export class ResizableView extends View {
315
313
316
314
const resizeBarDesiredSize = this . _resizeBar . desiredSize ( ) ;
317
315
318
- let currentY = y ;
319
-
320
- this . _subview . setFrame ( {
321
- origin : { x, y : currentY } ,
322
- size : { width, height : barOffsetY } ,
323
- } ) ;
324
- currentY += this . _subview . frame . size . height ;
316
+ if ( barOffsetY === 0 ) {
317
+ this . _subview . setFrame ( HIDDEN_RECT ) ;
318
+ } else {
319
+ this . _subview . setFrame ( {
320
+ origin : { x, y} ,
321
+ size : { width, height : barOffsetY } ,
322
+ } ) ;
323
+ }
325
324
326
325
this . _resizeBar . setFrame ( {
327
- origin : { x, y : currentY } ,
326
+ origin : { x, y : y + barOffsetY } ,
328
327
size : { width, height : resizeBarDesiredSize . height } ,
329
328
} ) ;
330
- currentY += this . _resizeBar . frame . size . height ;
331
329
}
332
330
333
331
_handleClick ( interaction : ClickInteraction ) {
@@ -388,8 +386,6 @@ export class ResizableView extends View {
388
386
}
389
387
}
390
388
391
- _didGrab: boolean = false ;
392
-
393
389
getCursorActiveSubView ( interaction : Interaction ) : View | null {
394
390
const cursorLocation = interaction . payload . location ;
395
391
const resizeBarFrame = this . _resizeBar . frame ;
0 commit comments