Request a redraw when the url change through the `popstate` event listener (#7403)
<!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/main/CONTRIBUTING.md) before opening a Pull Request! * Keep your PR:s small and focused. * The PR title is what ends up in the changelog, so make it descriptive! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> Hey, I added an event listener on the [`popstate` event](https://developer.mozilla.org/en-US/docs/Web/API/Window/popstate_event). That fixed my issue https://github.com/user-attachments/assets/a621dac9-b7c3-426a-968b-dc73c5702eea * Closes https://github.com/emilk/egui/issues/7402 * [x] I have followed the instructions in the PR template
This commit is contained in:
parent
fdcaff8465
commit
7fb13d85ec
|
|
@ -405,7 +405,7 @@ fn install_window_events(runner_ref: &WebRunner, window: &EventTarget) -> Result
|
|||
|
||||
// No need to subscribe to "resize": we already subscribe to the canvas
|
||||
// size using a ResizeObserver, and we also subscribe to DPR changes of the monitor.
|
||||
for event_name in &["load", "pagehide", "pageshow"] {
|
||||
for event_name in &["load", "pagehide", "pageshow", "popstate"] {
|
||||
runner_ref.add_event_listener(window, event_name, move |_: web_sys::Event, runner| {
|
||||
if DEBUG_RESIZE {
|
||||
log::debug!("{event_name:?}");
|
||||
|
|
|
|||
Loading…
Reference in New Issue