dockview-core
Version:
Zero dependency layout manager supporting tabs, groups, grids and splitviews for vanilla TypeScript
45 lines (44 loc) • 1.6 kB
JavaScript
import { CompositeDisposable } from '../lifecycle';
export class DockviewFloatingGroupPanel extends CompositeDisposable {
/**
* The window's representative/anchor group. A floating window can host a
* nested layout of several groups; the anchor is used for back-compat
* single-group APIs and is reassigned if it leaves the window.
*/
get group() {
return this._group;
}
/**
* Register the dedicated title bar (if any) so anchor reassignment keeps
* its drag handle pointed at a group that still lives in this window.
*/
setTitleBar(titleBar) {
this._titleBar = titleBar;
}
setAnchorGroup(group) {
var _a;
this._group = group;
(_a = this._titleBar) === null || _a === void 0 ? void 0 : _a.setGroup(group);
}
constructor(group, overlay,
/**
* The floating window hosts its own gridview so it can hold a nested
* splitview layout of groups, not just a single group.
*/
gridview) {
super();
this.overlay = overlay;
this.gridview = gridview;
this._group = group;
this.addDisposables(overlay, {
// The gridview owns the floating window's DOM subtree (mounted as
// the overlay's content). Disposing it tears down the splitview;
// it does NOT dispose the leaf views (groups) — their lifecycle is
// owned by the component's `_groups` map.
dispose: () => this.gridview.dispose(),
});
}
position(bounds) {
this.overlay.setBounds(bounds);
}
}