Skip to content

Commit

Permalink
feat: ensure view priority used for viewChange events
Browse files Browse the repository at this point in the history
  • Loading branch information
mathuo committed Sep 30, 2023
1 parent 206255b commit 5baedea
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions packages/dockview-core/src/splitview/splitview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export interface SplitViewOptions {
readonly proportionalLayout?: boolean;
readonly styles?: ISplitviewStyles;
}


export enum LayoutPriority {
Low = 'low',
High = 'high',
Normal = 'normal',
Low = 'low', // view is offered space last
High = 'high', // view is offered space first
Normal = 'normal', // view is offered space in view order
}

export interface IBaseView extends IDisposable {
Expand Down Expand Up @@ -340,7 +342,19 @@ export class Splitview {

item.size = size;

this.relayout([index]);
const indexes = range(this.viewItems.length).filter((i) => i !== index);
const lowPriorityIndexes = [
...indexes.filter(
(i) => this.viewItems[i].priority === LayoutPriority.Low
),
index,
];
const highPriorityIndexes = indexes.filter(
(i) => this.viewItems[i].priority === LayoutPriority.High
);

// this.relayout([index]);
this.relayout([index, ...lowPriorityIndexes], highPriorityIndexes);
}

public addView(
Expand Down

0 comments on commit 5baedea

Please sign in to comment.