From fc046add78f676118886ee6ab00684913a2895e1 Mon Sep 17 00:00:00 2001 From: dAxpeDDa Date: Sun, 11 Jun 2023 22:30:24 +0200 Subject: [PATCH] Resume propagation of events --- src/platform_impl/web/web_sys/canvas.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/platform_impl/web/web_sys/canvas.rs b/src/platform_impl/web/web_sys/canvas.rs index 25bc63a7..ea724822 100644 --- a/src/platform_impl/web/web_sys/canvas.rs +++ b/src/platform_impl/web/web_sys/canvas.rs @@ -378,16 +378,10 @@ impl Common { E: 'static + AsRef + wasm_bindgen::convert::FromWasmAbi, F: 'static + FnMut(E), { - let closure = Closure::wrap(Box::new(move |event: E| { - { - let event_ref = event.as_ref(); - event_ref.stop_propagation(); - event_ref.cancel_bubble(); - } - + let closure = Closure::new(move |event: E| { + event.as_ref().stop_propagation(); handler(event); - }) as Box); - + }); EventListenerHandle::new(&self.raw, event_name, closure) }