mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-15 09:35:37 -05:00
Fix stating for scrolls (#2615)
* nearly working * add accounting for the downsides to slickgrid
This commit is contained in:
committed by
Karl Burtram
parent
c8c6d072f6
commit
f7abf5a2d5
@@ -34,6 +34,8 @@ export interface IView extends HeightIView {
|
||||
readonly onDidChange: Event<number | undefined>;
|
||||
render(container: HTMLElement, orientation: Orientation): void;
|
||||
layout(size: number, orientation: Orientation): void;
|
||||
onAdd?(): void;
|
||||
onRemove?(): void;
|
||||
}
|
||||
|
||||
interface ISashEvent {
|
||||
@@ -48,6 +50,8 @@ interface IViewItem extends HeightIViewItem {
|
||||
container: HTMLElement;
|
||||
disposable: IDisposable;
|
||||
layout(): void;
|
||||
onRemove: () => void;
|
||||
onAdd: () => void;
|
||||
}
|
||||
|
||||
interface ISashItem {
|
||||
@@ -159,6 +163,9 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
});
|
||||
const disposable = combinedDisposable([onChangeDisposable, containerDisposable]);
|
||||
|
||||
const onAdd = view.onAdd ? () => view.onAdd() : () => { };
|
||||
const onRemove = view.onRemove ? () => view.onRemove() : () => { };
|
||||
|
||||
const layoutContainer = this.orientation === Orientation.VERTICAL
|
||||
? size => item.container.style.height = `${item.size}px`
|
||||
: size => item.container.style.width = `${item.size}px`;
|
||||
@@ -169,7 +176,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
};
|
||||
|
||||
size = Math.round(size);
|
||||
const item: IViewItem = { view, container, size, layout, disposable, height: size, top: 0, width: 0 };
|
||||
const item: IViewItem = { onRemove, onAdd, view, container, size, layout, disposable, height: size, top: 0, width: 0 };
|
||||
this.viewItems.splice(viewIndex, 0, item);
|
||||
|
||||
this.onInsertItems(new ArrayIterator([item]), viewIndex > 0 ? this.viewItems[viewIndex - 1].view.id : undefined);
|
||||
@@ -224,6 +231,9 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
});
|
||||
const disposable = combinedDisposable([onChangeDisposable, containerDisposable]);
|
||||
|
||||
const onAdd = view.onAdd ? () => view.onAdd() : () => { };
|
||||
const onRemove = view.onRemove ? () => view.onRemove() : () => { };
|
||||
|
||||
const layoutContainer = this.orientation === Orientation.VERTICAL
|
||||
? size => item.container.style.height = `${item.size}px`
|
||||
: size => item.container.style.width = `${item.size}px`;
|
||||
@@ -234,7 +244,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
};
|
||||
|
||||
size = Math.round(size);
|
||||
const item: IViewItem = { view, container, size, layout, disposable, height: size, top: 0, width: 0 };
|
||||
const item: IViewItem = { onAdd, onRemove, view, container, size, layout, disposable, height: size, top: 0, width: 0 };
|
||||
this.viewItems.splice(index, 0, item);
|
||||
|
||||
this.onInsertItems(new ArrayIterator([item]), index > 0 ? this.viewItems[index - 1].view.id : undefined);
|
||||
@@ -495,6 +505,8 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
}
|
||||
|
||||
item.layout();
|
||||
|
||||
item.onAdd();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -504,6 +516,8 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
|
||||
}
|
||||
|
||||
this.el.removeChild(item.container);
|
||||
|
||||
item.onRemove();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user