MCPcopy
hub / github.com/mathuo/dockview / onDidChange

Method onDidChange

packages/dockview-core/src/splitview/splitview.ts:357–385  ·  view source on GitHub ↗
(item: ViewItem, size: number | undefined)

Source from the content-addressed store, hash-verified

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,

Callers 13

addViewMethod · 0.95
addMethod · 0.80
_doCreateTabGroupMethod · 0.80
initMethod · 0.80
_ensureChipForGroupMethod · 0.80
paneviewMethod · 0.80
constructorMethod · 0.80
rootMethod · 0.80
normalizeMethod · 0.80
constructorFunction · 0.80

Calls 4

relayoutMethod · 0.95
clampFunction · 0.90
rangeFunction · 0.90
indexOfMethod · 0.65

Tested by

no test coverage detected