mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix sizing error when switching windows (#2544)
* add work around for when we need to resize while we don't have a dimension to resize off of * formatting
This commit is contained in:
@@ -27,6 +27,7 @@ class ResultsView implements IPanelView {
|
|||||||
private container = document.createElement('div');
|
private container = document.createElement('div');
|
||||||
private currentDimension: DOM.Dimension;
|
private currentDimension: DOM.Dimension;
|
||||||
private isGridRendered = false;
|
private isGridRendered = false;
|
||||||
|
private needsGridResize = false;
|
||||||
private lastGridHeight: number;
|
private lastGridHeight: number;
|
||||||
|
|
||||||
constructor(instantiationService: IInstantiationService) {
|
constructor(instantiationService: IInstantiationService) {
|
||||||
@@ -51,19 +52,34 @@ class ResultsView implements IPanelView {
|
|||||||
this.isGridRendered = false;
|
this.isGridRendered = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (size > 0) {
|
if (this.currentDimension) {
|
||||||
|
this.needsGridResize = false;
|
||||||
|
if (size > 0) {
|
||||||
|
this.panelViewlet.addPanels([
|
||||||
|
{ panel: this.gridPanel, index: 0, size: this.lastGridHeight || Math.round(this.currentDimension.height * .7) }
|
||||||
|
]);
|
||||||
|
this.isGridRendered = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
this.panelViewlet.addPanels([
|
this.panelViewlet.addPanels([
|
||||||
{ panel: this.gridPanel, index: 0, size: this.lastGridHeight || Math.round(this.currentDimension.height * .8) }
|
{ panel: this.gridPanel, index: 0, size: this.lastGridHeight || 200 }
|
||||||
]);
|
]);
|
||||||
this.isGridRendered = true;
|
this.isGridRendered = true;
|
||||||
|
this.needsGridResize = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let gridResizeList = this.gridPanel.onDidChange(e => {
|
let gridResizeList = this.gridPanel.onDidChange(e => {
|
||||||
this.panelViewlet.resizePanel(this.gridPanel, Math.round(this.currentDimension.height * .8));
|
if (this.currentDimension) {
|
||||||
|
this.needsGridResize = false;
|
||||||
|
this.panelViewlet.resizePanel(this.gridPanel, Math.round(this.currentDimension.height * .7));
|
||||||
|
} else {
|
||||||
|
this.needsGridResize = true;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// once the user changes the sash we should stop trying to resize the grid
|
// once the user changes the sash we should stop trying to resize the grid
|
||||||
once(this.panelViewlet.onDidSashChange)(e => {
|
once(this.panelViewlet.onDidSashChange)(e => {
|
||||||
|
this.needsGridResize = false;
|
||||||
gridResizeList.dispose();
|
gridResizeList.dispose();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -79,6 +95,9 @@ class ResultsView implements IPanelView {
|
|||||||
this.gridPanel.layout(dimension.height);
|
this.gridPanel.layout(dimension.height);
|
||||||
}
|
}
|
||||||
this.currentDimension = dimension;
|
this.currentDimension = dimension;
|
||||||
|
if (this.needsGridResize) {
|
||||||
|
this.panelViewlet.resizePanel(this.gridPanel, Math.round(this.currentDimension.height * .7));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
remove(): void {
|
remove(): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user