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:
parent
c4f16af721
commit
60da4b4f65
|
|
@ -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| {
|
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
|
// `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.frame.info.web_info.location.hash = location_hash();
|
||||||
|
runner.needs_repaint.repaint_asap(); // tell the user about the new hash
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue