From 07d2fc0db4818352aff5911d8bc76e8553712a05 Mon Sep 17 00:00:00 2001 From: Danilo da Silveira Figueira Date: Wed, 21 Feb 2024 00:14:50 -0300 Subject: [PATCH] fix: Cross block selection gets wrong when pointer leaves the window area The mouse events doesnt work when the mouse get outs of the editor window. Related to issue #2167 --- src/components/modules/rectangleSelection.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/modules/rectangleSelection.ts b/src/components/modules/rectangleSelection.ts index d545036d2..e271968b4 100644 --- a/src/components/modules/rectangleSelection.ts +++ b/src/components/modules/rectangleSelection.ts @@ -185,14 +185,14 @@ export default class RectangleSelection extends Module { this.processMouseDown(mouseEvent); }, false); - this.listeners.on(document.body, 'mousemove', _.throttle((mouseEvent: MouseEvent) => { + this.listeners.on(window, 'mousemove', _.throttle((mouseEvent: MouseEvent) => { this.processMouseMove(mouseEvent); // eslint-disable-next-line @typescript-eslint/no-magic-numbers }, 10), { passive: true, }); - this.listeners.on(document.body, 'mouseleave', () => { + this.listeners.on(window, 'mouseleave', () => { this.processMouseLeave(); }); @@ -203,7 +203,7 @@ export default class RectangleSelection extends Module { passive: true, }); - this.listeners.on(document.body, 'mouseup', () => { + this.listeners.on(window, 'mouseup', () => { this.processMouseUp(); }, false); }