Web: repaint if the `#hash` in the URL changes (#4261)

Fixes a problem in egui.rs where the back-button would not work to
switch between the top-level tabs
This commit is contained in:
Emil Ernerfeldt 2024-03-29 10:59:24 +01:00 committed by GitHub
parent c4f16af721
commit 60da4b4f65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -242,6 +242,7 @@ pub(crate) fn install_window_events(runner_ref: &WebRunner) -> Result<(), JsValu
runner_ref.add_event_listener(&window, "hashchange", |_: web_sys::Event, runner| {
// `epi::Frame::info(&self)` clones `epi::IntegrationInfo`, but we need to modify the original here
runner.frame.info.web_info.location.hash = location_hash();
runner.needs_repaint.repaint_asap(); // tell the user about the new hash
})?;
Ok(())