From 97a222aa2bb49fdd736ebf35604a2d3deb8c28b1 Mon Sep 17 00:00:00 2001 From: white-axe Date: Mon, 9 Oct 2023 16:31:02 +0000 Subject: [PATCH] Save on mouseleave in web builds --- src/web/web_worker_runner.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/web/web_worker_runner.rs b/src/web/web_worker_runner.rs index 3544024d..449e46c6 100644 --- a/src/web/web_worker_runner.rs +++ b/src/web/web_worker_runner.rs @@ -620,10 +620,12 @@ pub fn setup_main_thread_hooks( { let event_tx = event_tx.clone(); + let custom_event_tx = custom_event_tx.clone(); let callback: Closure = Closure::new(move |e: web_sys::MouseEvent| { if PANIC_LOCK.get().is_some() { return; } + let _ = custom_event_tx.send(WebWorkerRunnerEvent(WebWorkerRunnerEventInner::Save)); let _ = event_tx.send(egui::Event::PointerGone); e.stop_propagation(); e.prevent_default();