normalize sizes when starting drag operation

This commit is contained in:
Bruno Windels 2019-01-11 17:17:58 +01:00
parent 9456fc040d
commit a413f358f7
5 changed files with 51 additions and 39 deletions

View file

@ -107,6 +107,7 @@ export class Resizer {
}
const {sizer, distributor} = this._createSizerAndDistributor(resizeHandle);
distributor.start();
const onMouseMove = (event) => {
const offset = sizer.offsetFromEvent(event);
@ -118,9 +119,11 @@ export class Resizer {
if (this.classNames.resizing) {
this.container.classList.remove(this.classNames.resizing);
}
distributor.finish();
body.removeEventListener("mouseup", onMouseUp, false);
body.removeEventListener("mousemove", onMouseMove, false);
};
// TODO: listen for mouseout on document here as well
body.addEventListener("mouseup", onMouseUp, false);
body.addEventListener("mousemove", onMouseMove, false);
}