mirror of
https://github.com/mathuo/dockview
synced 2025-02-13 11:55:45 +00:00
bug: fix setVisible on floating groups
This commit is contained in:
parent
1a9ee8c34e
commit
c9e90168a4
@ -538,6 +538,31 @@ export class DockviewComponent
|
|||||||
this.updateWatermark();
|
this.updateWatermark();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override setVisible(panel: DockviewGroupPanel, visible: boolean): void {
|
||||||
|
switch (panel.api.location.type) {
|
||||||
|
case 'grid':
|
||||||
|
super.setVisible(panel, visible);
|
||||||
|
break;
|
||||||
|
case 'floating':
|
||||||
|
const item = this.floatingGroups.find(
|
||||||
|
(floatingGroup) => floatingGroup.group === panel
|
||||||
|
);
|
||||||
|
|
||||||
|
if (item) {
|
||||||
|
item.overlay.setVisible(visible);
|
||||||
|
panel.api._onDidVisibilityChange.fire({
|
||||||
|
isVisible: visible,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'popout':
|
||||||
|
console.warn(
|
||||||
|
'dockview: You cannot hide a group that is in a popout window'
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addPopoutGroup(
|
addPopoutGroup(
|
||||||
itemToPopout: DockviewPanel | DockviewGroupPanel,
|
itemToPopout: DockviewPanel | DockviewGroupPanel,
|
||||||
options?: {
|
options?: {
|
||||||
|
@ -34,6 +34,10 @@
|
|||||||
border: 1px solid var(--dv-tab-divider-color);
|
border: 1px solid var(--dv-tab-divider-color);
|
||||||
box-shadow: var(--dv-floating-box-shadow);
|
box-shadow: var(--dv-floating-box-shadow);
|
||||||
|
|
||||||
|
&.dv-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
&.dv-resize-container-dragging {
|
&.dv-resize-container-dragging {
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,8 @@ export class Overlay extends CompositeDisposable {
|
|||||||
private verticalAlignment: 'top' | 'bottom' | undefined;
|
private verticalAlignment: 'top' | 'bottom' | undefined;
|
||||||
private horiziontalAlignment: 'left' | 'right' | undefined;
|
private horiziontalAlignment: 'left' | 'right' | undefined;
|
||||||
|
|
||||||
|
private _isVisible: boolean;
|
||||||
|
|
||||||
set minimumInViewportWidth(value: number | undefined) {
|
set minimumInViewportWidth(value: number | undefined) {
|
||||||
this.options.minimumInViewportWidth = value;
|
this.options.minimumInViewportWidth = value;
|
||||||
}
|
}
|
||||||
@ -71,6 +73,10 @@ export class Overlay extends CompositeDisposable {
|
|||||||
return this._element;
|
return this._element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isVisible(): boolean {
|
||||||
|
return this._isVisible;
|
||||||
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly options: AnchoredBox & {
|
private readonly options: AnchoredBox & {
|
||||||
container: HTMLElement;
|
container: HTMLElement;
|
||||||
@ -84,6 +90,7 @@ export class Overlay extends CompositeDisposable {
|
|||||||
this.addDisposables(this._onDidChange, this._onDidChangeEnd);
|
this.addDisposables(this._onDidChange, this._onDidChangeEnd);
|
||||||
|
|
||||||
this._element.className = 'dv-resize-container';
|
this._element.className = 'dv-resize-container';
|
||||||
|
this._isVisible = true;
|
||||||
|
|
||||||
this.setupResize('top');
|
this.setupResize('top');
|
||||||
this.setupResize('bottom');
|
this.setupResize('bottom');
|
||||||
@ -110,6 +117,16 @@ export class Overlay extends CompositeDisposable {
|
|||||||
arialLevelTracker.push(this._element);
|
arialLevelTracker.push(this._element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setVisible(isVisible: boolean): void {
|
||||||
|
if (isVisible === this.isVisible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._isVisible = isVisible;
|
||||||
|
|
||||||
|
toggleClass(this.element, 'dv-hidden', !this.isVisible);
|
||||||
|
}
|
||||||
|
|
||||||
bringToFront(): void {
|
bringToFront(): void {
|
||||||
arialLevelTracker.push(this._element);
|
arialLevelTracker.push(this._element);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user