mirror of
https://github.com/element-hq/element-web
synced 2024-11-23 17:56:01 +03:00
stop resize operation when cursor leaves viewport
as mouseup can't be detected outside of viewport
This commit is contained in:
parent
a413f358f7
commit
136dd4a556
1 changed files with 5 additions and 4 deletions
|
@ -115,16 +115,17 @@ export class Resizer {
|
|||
};
|
||||
|
||||
const body = document.body;
|
||||
const onMouseUp = (event) => {
|
||||
const finishResize = () => {
|
||||
if (this.classNames.resizing) {
|
||||
this.container.classList.remove(this.classNames.resizing);
|
||||
}
|
||||
distributor.finish();
|
||||
body.removeEventListener("mouseup", onMouseUp, false);
|
||||
body.removeEventListener("mouseup", finishResize, false);
|
||||
document.removeEventListener("mouseleave", finishResize, false);
|
||||
body.removeEventListener("mousemove", onMouseMove, false);
|
||||
};
|
||||
// TODO: listen for mouseout on document here as well
|
||||
body.addEventListener("mouseup", onMouseUp, false);
|
||||
body.addEventListener("mouseup", finishResize, false);
|
||||
document.addEventListener("mouseleave", finishResize, false);
|
||||
body.addEventListener("mousemove", onMouseMove, false);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue