diff --git a/crates/eframe/src/lib.rs b/crates/eframe/src/lib.rs index 7558163d..42ddc943 100644 --- a/crates/eframe/src/lib.rs +++ b/crates/eframe/src/lib.rs @@ -48,8 +48,9 @@ //! /// Call this once from the HTML. //! #[cfg(target_arch = "wasm32")] //! #[wasm_bindgen] -//! pub fn start(canvas_id: &str) -> Result<(), eframe::wasm_bindgen::JsValue> { -//! eframe::start_web(canvas_id, Box::new(|cc| Box::new(MyApp::new(cc)))) +//! pub fn start(canvas_id: &str) -> Result { +//! let web_options = eframe::WebOptions::default(); +//! eframe::start_web(canvas_id, web_options, Box::new(|cc| Box::new(MyEguiApp::new(cc)))) //! } //! ``` //! diff --git a/crates/eframe/src/web/mod.rs b/crates/eframe/src/web/mod.rs index 98de396f..76a89079 100644 --- a/crates/eframe/src/web/mod.rs +++ b/crates/eframe/src/web/mod.rs @@ -108,6 +108,10 @@ pub fn resize_canvas_to_screen_size(canvas_id: &str, max_size_points: egui::Vec2 y: height as f32, }; + if width <= 0 || height <= 0 { + tracing::error!("egui canvas parent size is {}x{}. Try adding `html, body {{ height: 100%; width: 100% }}` to your CSS!", width, height); + } + let pixels_per_point = native_pixels_per_point(); let max_size_pixels = pixels_per_point * max_size_points; diff --git a/crates/egui/src/containers/scroll_area.rs b/crates/egui/src/containers/scroll_area.rs index 56c1ab64..f35e8021 100644 --- a/crates/egui/src/containers/scroll_area.rs +++ b/crates/egui/src/containers/scroll_area.rs @@ -479,7 +479,7 @@ impl ScrollArea { /// This can be used to only paint the visible part of the contents. /// - /// `add_contents` is past the viewport, which is the relative view of the content. + /// `add_contents` is given the viewport rectangle, which is the relative view of the content. /// So if the passed rect has min = zero, then show the top left content (the user has not scrolled). pub fn show_viewport( self, diff --git a/crates/egui_extras/src/image.rs b/crates/egui_extras/src/image.rs index 54310e30..7761ecdf 100644 --- a/crates/egui_extras/src/image.rs +++ b/crates/egui_extras/src/image.rs @@ -29,6 +29,8 @@ impl RetainedImage { /// Load a (non-svg) image. /// + /// `image_bytes` should be the raw contents of an image file (`.png`, `.jpg`, …). + /// /// Requires the "image" feature. You must also opt-in to the image formats you need /// with e.g. `image = { version = "0.24", features = ["jpeg", "png"] }`. /// diff --git a/sh/docs.sh b/sh/docs.sh index 33a352f0..081eff39 100755 --- a/sh/docs.sh +++ b/sh/docs.sh @@ -3,7 +3,7 @@ set -eu script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) cd "$script_path/.." -cargo doc -p eframe --target wasm32-unknown-unknown --lib --no-deps --all-features +cargo doc -p eframe --target wasm32-unknown-unknown --lib --no-deps cargo doc -p emath -p epaint -p egui -p eframe -p egui-winit -p egui_extras -p egui_glium -p egui_glow --lib --no-deps --all-features --open # cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features'