mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
eframe: Fix clicks in web (#3640)
Closes https://github.com/emilk/egui/issues/3633 Bug introduced in #3623 (after 0.24.0 was cut)
This commit is contained in:
@@ -17,8 +17,25 @@ fn paint_and_schedule(runner_ref: &WebRunner) -> Result<(), JsValue> {
|
||||
|
||||
fn paint_if_needed(runner: &mut AppRunner) {
|
||||
if runner.needs_repaint.needs_repaint() {
|
||||
runner.needs_repaint.clear();
|
||||
runner.run_and_paint();
|
||||
if runner.has_outstanding_paint_data() {
|
||||
// We have already run the logic, e.g. in an on-click event,
|
||||
// so let's only present the results:
|
||||
runner.paint();
|
||||
|
||||
// We schedule another repaint asap, so that we can run the actual logic
|
||||
// again, which may schedule a new repaint (if there's animations):
|
||||
runner.needs_repaint.repaint_asap();
|
||||
} else {
|
||||
// Clear the `needs_repaint` flags _before_
|
||||
// running the logic, as the logic could cause it to be set again.
|
||||
runner.needs_repaint.clear();
|
||||
|
||||
// Run user code…
|
||||
runner.logic();
|
||||
|
||||
// …and paint the result.
|
||||
runner.paint();
|
||||
}
|
||||
}
|
||||
runner.auto_save_if_needed();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user