Improve documentation and logging
This commit is contained in:
parent
725aa5277b
commit
8737933101
5 changed files with 11 additions and 4 deletions
|
@ -48,8 +48,9 @@
|
||||||
//! /// Call this once from the HTML.
|
//! /// Call this once from the HTML.
|
||||||
//! #[cfg(target_arch = "wasm32")]
|
//! #[cfg(target_arch = "wasm32")]
|
||||||
//! #[wasm_bindgen]
|
//! #[wasm_bindgen]
|
||||||
//! pub fn start(canvas_id: &str) -> Result<(), eframe::wasm_bindgen::JsValue> {
|
//! pub fn start(canvas_id: &str) -> Result<AppRunnerRef, eframe::wasm_bindgen::JsValue> {
|
||||||
//! eframe::start_web(canvas_id, Box::new(|cc| Box::new(MyApp::new(cc))))
|
//! let web_options = eframe::WebOptions::default();
|
||||||
|
//! eframe::start_web(canvas_id, web_options, Box::new(|cc| Box::new(MyEguiApp::new(cc))))
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -108,6 +108,10 @@ pub fn resize_canvas_to_screen_size(canvas_id: &str, max_size_points: egui::Vec2
|
||||||
y: height as f32,
|
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 pixels_per_point = native_pixels_per_point();
|
||||||
|
|
||||||
let max_size_pixels = pixels_per_point * max_size_points;
|
let max_size_pixels = pixels_per_point * max_size_points;
|
||||||
|
|
|
@ -479,7 +479,7 @@ impl ScrollArea {
|
||||||
|
|
||||||
/// This can be used to only paint the visible part of the contents.
|
/// 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).
|
/// So if the passed rect has min = zero, then show the top left content (the user has not scrolled).
|
||||||
pub fn show_viewport<R>(
|
pub fn show_viewport<R>(
|
||||||
self,
|
self,
|
||||||
|
|
|
@ -29,6 +29,8 @@ impl RetainedImage {
|
||||||
|
|
||||||
/// Load a (non-svg) image.
|
/// 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
|
/// 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"] }`.
|
/// with e.g. `image = { version = "0.24", features = ["jpeg", "png"] }`.
|
||||||
///
|
///
|
||||||
|
|
|
@ -3,7 +3,7 @@ set -eu
|
||||||
script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||||
cd "$script_path/.."
|
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 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'
|
# cargo watch -c -x 'doc -p emath -p epaint -p egui --lib --no-deps --all-features'
|
||||||
|
|
Loading…
Reference in a new issue