From d28c77faa2c89e250b89d2946b188fc41dcb8b7f Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 28 Jul 2022 23:28:43 +0900 Subject: [PATCH] don't send mouse events when execution is paused --- src/browser/mouse.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/browser/mouse.js b/src/browser/mouse.js index c329d885..644200f2 100644 --- a/src/browser/mouse.js +++ b/src/browser/mouse.js @@ -32,6 +32,17 @@ function MouseAdapter(bus, screen_container) this.enabled = enabled; }, this); + // TODO: Should probably not use bus for this + this.is_running = false; + this.bus.register("emulator-stopped", function() + { + this.is_running = false; + }, this); + this.bus.register("emulator-started", function() + { + this.is_running = true; + }, this); + this.destroy = function() { if(typeof window === "undefined") @@ -145,6 +156,11 @@ function MouseAdapter(bus, screen_container) return; } + if(!mouse.is_running) + { + return; + } + var delta_x = 0; var delta_y = 0;