Browse Source

egui_web: document how to fill the full width of the browser

pull/458/head
Emil Ernerfeldt 3 years ago
parent
commit
ec6268e4ac
  1. 3
      README.md
  2. 4
      eframe/src/lib.rs
  3. 5
      egui_web/src/lib.rs

3
README.md

@ -304,6 +304,9 @@ The _frame_ in `eframe` stands both for the frame in which your egui app resides
### Why is `egui_web` using so much CPU in Firefox?
On Linux and Mac, Firefox will copy the WebGL render target from GPU, to CPU and then back again: https://bugzilla.mozilla.org/show_bug.cgi?id=1010527#c0
### Why does my web app not fill the full width of the screen?
To alleviate the above mentioned performance issues the default max-width of an egui web app is 1024 points. You can change this by ovveriding the `fn max_size_points` of `epi::App`.
## Other

4
eframe/src/lib.rs

@ -35,6 +35,10 @@ pub use egui_web::wasm_bindgen;
/// Install event listeners to register different input events
/// and start running the given app.
///
/// For performance reasons (on some browsers) the egui canvas does not, by default,
/// fill the whole width of the browser.
/// This can be changed by overriding [`epi::Frame::max_size_points`].
///
/// Usage:
/// ``` no_run
/// #[cfg(target_arch = "wasm32")]

5
egui_web/src/lib.rs

@ -3,6 +3,11 @@
//! This library is an [`epi`] backend.
//!
//! If you are writing an app, you may want to look at [`eframe`](https://docs.rs/eframe) instead.
//!
//! ## Specifying the size of the egui canvas
//! For performance reasons (on some browsers) the egui canvas does not, by default,
//! fill the whole width of the browser.
//! This can be changed by overriding [`epi::App::max_size_points`].
#![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
#![deny(

Loading…
Cancel
Save