提交 ecd653b4 编写于 作者: J Johannes Rieken

use the right numbers when computing the new sash ratio, fixes #6599

上级 03b20768
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册