mirror of
https://github.com/mathuo/dockview
synced 2025-09-17 22:59:35 +00:00
feat: fix sonar bugs
This commit is contained in:
parent
8f49d29bdb
commit
929690e730
@ -62,7 +62,8 @@ export class DefaultGroupPanelView implements IGroupPanelView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
|
updateParentGroup(group: GroupviewPanel, isPanelVisible: boolean): void {
|
||||||
// TODO
|
this._content.updateParentGroup(group, isPanelVisible);
|
||||||
|
this._tab?.updateParentGroup(group, isPanelVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
layout(width: number, height: number): void {
|
layout(width: number, height: number): void {
|
||||||
|
@ -101,3 +101,24 @@ export function addDisposableListener<K extends keyof HTMLElementEventMap>(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class TickDelayedEvent implements IDisposable {
|
||||||
|
private timer: any;
|
||||||
|
|
||||||
|
private readonly _onFired = new Emitter<void>();
|
||||||
|
readonly onEvent = this._onFired.event;
|
||||||
|
|
||||||
|
fire(): void {
|
||||||
|
if (this.timer) {
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
}
|
||||||
|
this.timer = setTimeout(() => {
|
||||||
|
this._onFired.fire();
|
||||||
|
clearTimeout(this.timer);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
dispose(): void {
|
||||||
|
this._onFired.dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Emitter, Event } from '../events';
|
import { Emitter, Event, TickDelayedEvent } from '../events';
|
||||||
import { getGridLocation, Gridview, IGridView } from './gridview';
|
import { getGridLocation, Gridview, IGridView } from './gridview';
|
||||||
import { Position } from '../dnd/droptarget';
|
import { Position } from '../dnd/droptarget';
|
||||||
import { CompositeDisposable, IValueDisposable } from '../lifecycle';
|
import { CompositeDisposable, IValueDisposable } from '../lifecycle';
|
||||||
@ -165,12 +165,10 @@ export abstract class BaseGrid<T extends IGridPanelView>
|
|||||||
|
|
||||||
this.addDisposables(
|
this.addDisposables(
|
||||||
(() => {
|
(() => {
|
||||||
/**
|
const tickDelayedEvent = new TickDelayedEvent();
|
||||||
* TODO Fix this relatively ugly 'merge and delay'
|
|
||||||
*/
|
|
||||||
let timer: any;
|
|
||||||
|
|
||||||
return this.onGridEvent((event) => {
|
return new CompositeDisposable(
|
||||||
|
this.onGridEvent((event) => {
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
GroupChangeKind.ADD_GROUP,
|
GroupChangeKind.ADD_GROUP,
|
||||||
@ -182,20 +180,20 @@ export abstract class BaseGrid<T extends IGridPanelView>
|
|||||||
GroupChangeKind.LAYOUT,
|
GroupChangeKind.LAYOUT,
|
||||||
].includes(event.kind)
|
].includes(event.kind)
|
||||||
) {
|
) {
|
||||||
if (timer) {
|
tickDelayedEvent.fire();
|
||||||
clearTimeout(timer);
|
|
||||||
}
|
}
|
||||||
timer = setTimeout(() => {
|
}),
|
||||||
|
tickDelayedEvent.onEvent(() => {
|
||||||
this._onDidLayoutChange.fire();
|
this._onDidLayoutChange.fire();
|
||||||
clearTimeout(timer);
|
}),
|
||||||
});
|
tickDelayedEvent
|
||||||
}
|
);
|
||||||
});
|
|
||||||
})()
|
})()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract toJSON(): object;
|
public abstract toJSON(): object;
|
||||||
|
|
||||||
public abstract fromJSON(data: any): void;
|
public abstract fromJSON(data: any): void;
|
||||||
|
|
||||||
public setVisible(panel: T, visible: boolean) {
|
public setVisible(panel: T, visible: boolean) {
|
||||||
|
@ -60,7 +60,7 @@ function flipNode<T extends Node>(
|
|||||||
return result as T;
|
return result as T;
|
||||||
} else {
|
} else {
|
||||||
return new LeafNode(
|
return new LeafNode(
|
||||||
(node as LeafNode).view,
|
node.view,
|
||||||
orthogonal(node.orientation),
|
orthogonal(node.orientation),
|
||||||
orthogonalSize
|
orthogonalSize
|
||||||
) as T;
|
) as T;
|
||||||
@ -161,11 +161,7 @@ export interface IGridView {
|
|||||||
readonly minimumHeight: number;
|
readonly minimumHeight: number;
|
||||||
readonly maximumHeight: number;
|
readonly maximumHeight: number;
|
||||||
priority?: LayoutPriority;
|
priority?: LayoutPriority;
|
||||||
layout(
|
layout(width: number, height: number): void;
|
||||||
width: number,
|
|
||||||
height: number
|
|
||||||
// top: number, left: number
|
|
||||||
): void;
|
|
||||||
toJSON(): object;
|
toJSON(): object;
|
||||||
fromJSON?(json: object): void;
|
fromJSON?(json: object): void;
|
||||||
snap?: boolean;
|
snap?: boolean;
|
||||||
@ -615,7 +611,6 @@ export class Gridview implements IDisposable {
|
|||||||
parent.removeChild(index, sizing);
|
parent.removeChild(index, sizing);
|
||||||
|
|
||||||
if (parent.children.length === 0) {
|
if (parent.children.length === 0) {
|
||||||
// throw new Error('Invalid grid state');
|
|
||||||
return node.view;
|
return node.view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ export class Groupview extends CompositeDisposable implements IGroupview {
|
|||||||
this.accessor.doSetGroupActive(this.parent, true);
|
this.accessor.doSetGroupActive(this.parent, true);
|
||||||
}),
|
}),
|
||||||
this.contentContainer.onDidBlur(() => {
|
this.contentContainer.onDidBlur(() => {
|
||||||
// this._activePanel?.api._ondid
|
// noop
|
||||||
}),
|
}),
|
||||||
this.dropTarget.onDrop((event) => {
|
this.dropTarget.onDrop((event) => {
|
||||||
this.handleDropEvent(event.event, event.position);
|
this.handleDropEvent(event.event, event.position);
|
||||||
|
@ -165,10 +165,6 @@ export class Paneview extends CompositeDisposable implements IDisposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public layout(size: number, orthogonalSize: number): void {
|
public layout(size: number, orthogonalSize: number): void {
|
||||||
// for (const paneItem of this.paneItems) {
|
|
||||||
// paneItem.pane.orthogonalSize = orthogonalSize;
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.splitview.layout(size, orthogonalSize);
|
this.splitview.layout(size, orthogonalSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user