Skip to content

Commit

Permalink
Make sure to call raw_input_hook on web (emilk#4646)
Browse files Browse the repository at this point in the history
## What's new
* Extends @varphone's excellent `raw_input_hook` idea from
emilk#4008 to `web/app_runner`.

## Details
Debugging this locally after my app's `raw_input_hook` wasn't being
called, I realized it's not in the code path of eframe's web runner,
only the native integration. Below is a toy example running on the web.


https://github.com/emilk/egui/assets/8173478/d470b7e6-d393-4ead-9745-3aafc72ae6bc
  • Loading branch information
owen-d authored and hacknus committed Oct 30, 2024
1 parent f75934e commit 0b280de
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/eframe/src/web/app_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ impl AppRunner {
/// The result can be painted later with a call to [`Self::run_and_paint`] or [`Self::paint`].
pub fn logic(&mut self) {
let canvas_size = super::canvas_size_in_points(self.canvas(), self.egui_ctx());
let raw_input = self.input.new_frame(canvas_size);
let mut raw_input = self.input.new_frame(canvas_size);

self.app.raw_input_hook(&self.egui_ctx, &mut raw_input);

let full_output = self.egui_ctx.run(raw_input, |egui_ctx| {
self.app.update(egui_ctx, &mut self.frame);
Expand Down

0 comments on commit 0b280de

Please sign in to comment.