Skip to content

Commit

Permalink
Save on mouseleave in web builds
Browse files Browse the repository at this point in the history
  • Loading branch information
white-axe committed Oct 9, 2023
1 parent ec4a0f8 commit 97a222a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/web/web_worker_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn Fn(_)> = 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();
Expand Down

0 comments on commit 97a222a

Please sign in to comment.