Skip to content

Commit

Permalink
docs(grid): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomoreno committed Nov 11, 2021
1 parent eca646d commit 30e88f9
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions src/vs/base/browser/ui/grid/gridview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,8 +1047,20 @@ export class GridView implements IDisposable {
this._onDidScroll.input = root.onDidScroll;
}

/**
* Fires whenever the user double clicks a {@link Sash sash}.
*/
readonly onDidSashReset = this.onDidSashResetRelay.event;

/**
* Fires whenever the user scrolls a {@link SplitView} within
* the grid.
*/
readonly onDidScroll = this._onDidScroll.event;

/**
* Fires whenever a view within the grid changes its size constraints.
*/
readonly onDidChange = this._onDidChange.event;

/**
Expand Down Expand Up @@ -1348,24 +1360,24 @@ export class GridView implements IDisposable {
}

/**
* Swap two {@link IView views} within the {@link GridView}.
* Resize a {@link IView view}.
*
* @param from The {@link GridLocation location} of one view.
* @param to The {@link GridLocation location} of another view.
* @param location The {@link GridLocation location} of the view.
* @param size The size the view should be. Optionally provide a single dimension.
*/
resizeView(location: GridLocation, { width, height }: Partial<IViewSize>): void {
resizeView(location: GridLocation, size: Partial<IViewSize>): void {
const [rest, index] = tail(location);
const [pathToParent, parent] = this.getNode(rest);

if (!(parent instanceof BranchNode)) {
throw new Error('Invalid location');
}

if (!width && !height) {
if (!size.width && !size.height) {
return;
}

const [parentSize, grandParentSize] = parent.orientation === Orientation.HORIZONTAL ? [width, height] : [height, width];
const [parentSize, grandParentSize] = parent.orientation === Orientation.HORIZONTAL ? [size.width, size.height] : [size.height, size.width];

if (typeof grandParentSize === 'number' && pathToParent.length > 0) {
const [, grandParent] = tail(pathToParent);
Expand Down

0 comments on commit 30e88f9

Please sign in to comment.