From ecd653b4593973551f0b70acc31e63555e460ef1 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Wed, 25 May 2016 12:23:22 +0200 Subject: [PATCH] use the right numbers when computing the new sash ratio, fixes #6599 --- .../referenceSearch/browser/referencesWidget.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts index b0473db1459..1b94c3756e8 100644 --- a/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts +++ b/src/vs/editor/contrib/referenceSearch/browser/referencesWidget.ts @@ -399,16 +399,19 @@ class VSash { getVerticalSashHeight: () => this._height }); - let data: { startX: number, startRatio: number }; + // compute the current widget clientX postion since + // the sash works with clientX when dragging + let clientX: number; this._disposables.add(this._sash.addListener2('start', (e: ISashEvent) => { - data = { startX: e.startX, startRatio: this._ratio }; + clientX = e.startX - (this._width * this.ratio); })); this._disposables.add(this._sash.addListener2('change', (e: ISashEvent) => { - let {currentX} = e; - let newRatio = data.startRatio * (currentX / data.startX); - if (newRatio > .05 && newRatio < .95) { - this._ratio = newRatio; + // compute the new position of the sash and from that + // compute the new ratio that we are using + let newLeft = e.currentX - clientX; + if (newLeft > 20 && newLeft + 20 < this._width) { + this._ratio = newLeft / this._width; this._sash.layout(); this._onDidChangePercentages.fire(this); } -- GitLab