@@ -588,7 +588,13 @@ export class DockviewComponent
588
588
panelId : data . panelId ?? undefined ,
589
589
} ,
590
590
to : {
591
- group : this . orthogonalize ( event . position ) ,
591
+ group : this . orthogonalize (
592
+ event . position ,
593
+ data . panelId
594
+ ? this . getGroupPanel ( data . panelId ) ?. api
595
+ . preferredSize
596
+ : undefined
597
+ ) ,
592
598
position : 'center' ,
593
599
} ,
594
600
} ) ;
@@ -991,7 +997,10 @@ export class DockviewComponent
991
997
this . updateWatermark ( ) ;
992
998
}
993
999
994
- private orthogonalize ( position : Position ) : DockviewGroupPanel {
1000
+ private orthogonalize (
1001
+ position : Position ,
1002
+ size ?: number
1003
+ ) : DockviewGroupPanel {
995
1004
switch ( position ) {
996
1005
case 'top' :
997
1006
case 'bottom' :
@@ -1017,10 +1026,10 @@ export class DockviewComponent
1017
1026
case 'top' :
1018
1027
case 'left' :
1019
1028
case 'center' :
1020
- return this . createGroupAtLocation ( [ 0 ] ) ; // insert into first position
1029
+ return this . createGroupAtLocation ( [ 0 ] , size ) ; // insert into first position
1021
1030
case 'bottom' :
1022
1031
case 'right' :
1023
- return this . createGroupAtLocation ( [ this . gridview . length ] ) ; // insert into last position
1032
+ return this . createGroupAtLocation ( [ this . gridview . length ] , size ) ; // insert into last position
1024
1033
default :
1025
1034
throw new Error ( `unsupported position ${ position } ` ) ;
1026
1035
}
@@ -1437,7 +1446,8 @@ export class DockviewComponent
1437
1446
}
1438
1447
} else {
1439
1448
const group = this . orthogonalize (
1440
- directionToPosition ( < Direction > options . position . direction )
1449
+ directionToPosition ( < Direction > options . position . direction ) ,
1450
+ options . preferredSize
1441
1451
) ;
1442
1452
1443
1453
const panel = this . createPanel ( options , group ) ;
@@ -1505,7 +1515,10 @@ export class DockviewComponent
1505
1515
location ,
1506
1516
target
1507
1517
) ;
1508
- const group = this . createGroupAtLocation ( relativeLocation ) ;
1518
+ const group = this . createGroupAtLocation (
1519
+ relativeLocation ,
1520
+ options . preferredSize
1521
+ ) ;
1509
1522
panel = this . createPanel ( options , group ) ;
1510
1523
group . model . openPanel ( panel , {
1511
1524
skipSetActive : options . inactive ,
@@ -1538,7 +1551,10 @@ export class DockviewComponent
1538
1551
skipSetGroupActive : options . inactive ,
1539
1552
} ) ;
1540
1553
} else {
1541
- const group = this . createGroupAtLocation ( ) ;
1554
+ const group = this . createGroupAtLocation (
1555
+ undefined ,
1556
+ options . preferredSize
1557
+ ) ;
1542
1558
panel = this . createPanel ( options , group ) ;
1543
1559
group . model . openPanel ( panel , {
1544
1560
skipSetActive : options . inactive ,
@@ -1659,7 +1675,8 @@ export class DockviewComponent
1659
1675
}
1660
1676
} else {
1661
1677
const group = this . orthogonalize (
1662
- directionToPosition ( < Direction > options . direction )
1678
+ directionToPosition ( < Direction > options . direction ) ,
1679
+ options . preferredSize
1663
1680
) ;
1664
1681
if ( ! options . skipSetActive ) {
1665
1682
this . doSetGroupAndPanelActive ( group ) ;
@@ -1942,7 +1959,13 @@ export class DockviewComponent
1942
1959
updatedReferenceLocation ,
1943
1960
destinationTarget
1944
1961
) ;
1945
- this . movingLock ( ( ) => this . doAddGroup ( targetGroup , location ) ) ;
1962
+ this . movingLock ( ( ) =>
1963
+ this . doAddGroup (
1964
+ targetGroup ,
1965
+ location ,
1966
+ targetGroup . activePanel ?. api . preferredSize
1967
+ )
1968
+ ) ;
1946
1969
this . doSetGroupAndPanelActive ( targetGroup ) ;
1947
1970
} else {
1948
1971
/**
@@ -1967,7 +1990,10 @@ export class DockviewComponent
1967
1990
destinationTarget
1968
1991
) ;
1969
1992
1970
- const group = this . createGroupAtLocation ( dropLocation ) ;
1993
+ const group = this . createGroupAtLocation (
1994
+ dropLocation ,
1995
+ removedPanel . api . preferredSize
1996
+ ) ;
1971
1997
this . movingLock ( ( ) =>
1972
1998
group . model . openPanel ( removedPanel , {
1973
1999
skipSetGroupActive : true ,
@@ -2219,7 +2245,11 @@ export class DockviewComponent
2219
2245
this . _api ,
2220
2246
group ,
2221
2247
view ,
2222
- { renderer : options . renderer }
2248
+ {
2249
+ renderer : options . renderer ,
2250
+ priority : options . priority ,
2251
+ preferredSize : options . preferredSize ,
2252
+ }
2223
2253
) ;
2224
2254
2225
2255
panel . init ( {
@@ -2231,10 +2261,11 @@ export class DockviewComponent
2231
2261
}
2232
2262
2233
2263
private createGroupAtLocation (
2234
- location : number [ ] = [ 0 ]
2264
+ location : number [ ] = [ 0 ] ,
2265
+ size ?: number
2235
2266
) : DockviewGroupPanel {
2236
2267
const group = this . createGroup ( ) ;
2237
- this . doAddGroup ( group , location ) ;
2268
+ this . doAddGroup ( group , location , size ) ;
2238
2269
return group ;
2239
2270
}
2240
2271
0 commit comments