@@ -41,7 +41,8 @@ function flipNode<T extends Node>(
41
41
node . proportionalLayout ,
42
42
node . styles ,
43
43
size ,
44
- orthogonalSize
44
+ orthogonalSize ,
45
+ node . disabled
45
46
) ;
46
47
47
48
let totalSize = 0 ;
@@ -273,6 +274,7 @@ export class Gridview implements IDisposable {
273
274
readonly element : HTMLElement ;
274
275
275
276
private _root : BranchNode | undefined ;
277
+ private _locked = false ;
276
278
private _maximizedNode :
277
279
| { leaf : LeafNode ; hiddenOnMaximize : LeafNode [ ] }
278
280
| undefined = undefined ;
@@ -330,6 +332,30 @@ export class Gridview implements IDisposable {
330
332
return this . root . maximumHeight ;
331
333
}
332
334
335
+ get locked ( ) : boolean {
336
+ return this . _locked ;
337
+ }
338
+
339
+ set locked ( value : boolean ) {
340
+ this . _locked = value ;
341
+
342
+ const branch : Node [ ] = [ this . root ] ;
343
+
344
+ /**
345
+ * simple depth-first-search to cover all nodes
346
+ *
347
+ * @see https://en.wikipedia.org/wiki/Depth-first_search
348
+ */
349
+ while ( branch . length > 0 ) {
350
+ const node = branch . pop ( ) ;
351
+
352
+ if ( node instanceof BranchNode ) {
353
+ node . disabled = value ;
354
+ branch . push ( ...node . children ) ;
355
+ }
356
+ }
357
+ }
358
+
333
359
maximizedView ( ) : IGridView | undefined {
334
360
return this . _maximizedNode ?. leaf . view ;
335
361
}
@@ -439,7 +465,8 @@ export class Gridview implements IDisposable {
439
465
this . proportionalLayout ,
440
466
this . styles ,
441
467
this . root . size ,
442
- this . root . orthogonalSize
468
+ this . root . orthogonalSize ,
469
+ this . _locked
443
470
) ;
444
471
}
445
472
@@ -499,8 +526,8 @@ export class Gridview implements IDisposable {
499
526
this . proportionalLayout ,
500
527
this . styles ,
501
528
node . size , // <- orthogonal size - flips at each depth
502
- orthogonalSize , // <- size - flips at each depth
503
-
529
+ orthogonalSize , // <- size - flips at each depth,
530
+ this . _locked ,
504
531
children
505
532
) ;
506
533
} else {
@@ -552,7 +579,8 @@ export class Gridview implements IDisposable {
552
579
this . proportionalLayout ,
553
580
this . styles ,
554
581
this . root . orthogonalSize ,
555
- this . root . size
582
+ this . root . size ,
583
+ this . _locked
556
584
) ;
557
585
558
586
if ( oldRoot . children . length === 0 ) {
@@ -667,7 +695,8 @@ export class Gridview implements IDisposable {
667
695
proportionalLayout ,
668
696
styles ,
669
697
0 ,
670
- 0
698
+ 0 ,
699
+ this . _locked
671
700
) ;
672
701
}
673
702
@@ -751,7 +780,8 @@ export class Gridview implements IDisposable {
751
780
this . proportionalLayout ,
752
781
this . styles ,
753
782
parent . size ,
754
- parent . orthogonalSize
783
+ parent . orthogonalSize ,
784
+ this . _locked
755
785
) ;
756
786
grandParent . addChild ( newParent , parent . size , parentIndex ) ;
757
787
0 commit comments