(item: ViewItem, size: number | undefined)
| 355 | } |
| 356 | |
| 357 | private onDidChange(item: ViewItem, size: number | undefined): void { |
| 358 | const index = this.viewItems.indexOf(item); |
| 359 | |
| 360 | if (index < 0 || index >= this.viewItems.length) { |
| 361 | return; |
| 362 | } |
| 363 | |
| 364 | size = typeof size === 'number' ? size : item.size; |
| 365 | size = clamp(size, item.minimumSize, item.maximumSize); |
| 366 | |
| 367 | item.size = size; |
| 368 | |
| 369 | const indexes = range(this.viewItems.length).filter((i) => i !== index); |
| 370 | const lowPriorityIndexes = [ |
| 371 | ...indexes.filter( |
| 372 | (i) => this.viewItems[i].priority === LayoutPriority.Low |
| 373 | ), |
| 374 | index, |
| 375 | ]; |
| 376 | const highPriorityIndexes = indexes.filter( |
| 377 | (i) => this.viewItems[i].priority === LayoutPriority.High |
| 378 | ); |
| 379 | |
| 380 | /** |
| 381 | * add this view we are changing to the low-index list since we have determined the size |
| 382 | * here and don't want it changed |
| 383 | */ |
| 384 | this.relayout([...lowPriorityIndexes, index], highPriorityIndexes); |
| 385 | } |
| 386 | |
| 387 | public addView( |
| 388 | view: IView, |
no test coverage detected