mirror of
https://github.com/mathuo/dockview
synced 2025-03-12 17:02:04 +00:00
feat: ensure view priority used for viewChange events
This commit is contained in:
parent
206255b411
commit
08ec3fd3a5
@ -37,10 +37,11 @@ export interface SplitViewOptions {
|
|||||||
readonly proportionalLayout?: boolean;
|
readonly proportionalLayout?: boolean;
|
||||||
readonly styles?: ISplitviewStyles;
|
readonly styles?: ISplitviewStyles;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum LayoutPriority {
|
export enum LayoutPriority {
|
||||||
Low = 'low',
|
Low = 'low', // view is offered space last
|
||||||
High = 'high',
|
High = 'high', // view is offered space first
|
||||||
Normal = 'normal',
|
Normal = 'normal', // view is offered space in view order
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IBaseView extends IDisposable {
|
export interface IBaseView extends IDisposable {
|
||||||
@ -340,7 +341,22 @@ export class Splitview {
|
|||||||
|
|
||||||
item.size = size;
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add this view we are changing to the low-index list since we have determined the size
|
||||||
|
* here and don't want it changed
|
||||||
|
*/
|
||||||
|
this.relayout([...lowPriorityIndexes, index], highPriorityIndexes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public addView(
|
public addView(
|
||||||
|
Loading…
Reference in New Issue
Block a user