mirror of https://github.com/vector-im/riot-web
stop resize operation when cursor leaves viewport
as mouseup can't be detected outside of viewportpull/21833/head
parent
a413f358f7
commit
136dd4a556
|
@ -115,16 +115,17 @@ export class Resizer {
|
||||||
};
|
};
|
||||||
|
|
||||||
const body = document.body;
|
const body = document.body;
|
||||||
const onMouseUp = (event) => {
|
const finishResize = () => {
|
||||||
if (this.classNames.resizing) {
|
if (this.classNames.resizing) {
|
||||||
this.container.classList.remove(this.classNames.resizing);
|
this.container.classList.remove(this.classNames.resizing);
|
||||||
}
|
}
|
||||||
distributor.finish();
|
distributor.finish();
|
||||||
body.removeEventListener("mouseup", onMouseUp, false);
|
body.removeEventListener("mouseup", finishResize, false);
|
||||||
|
document.removeEventListener("mouseleave", finishResize, false);
|
||||||
body.removeEventListener("mousemove", onMouseMove, false);
|
body.removeEventListener("mousemove", onMouseMove, false);
|
||||||
};
|
};
|
||||||
// TODO: listen for mouseout on document here as well
|
body.addEventListener("mouseup", finishResize, false);
|
||||||
body.addEventListener("mouseup", onMouseUp, false);
|
document.addEventListener("mouseleave", finishResize, false);
|
||||||
body.addEventListener("mousemove", onMouseMove, false);
|
body.addEventListener("mousemove", onMouseMove, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue