Skip to main content

loam_app/
lib.rs

1#[cfg(all(feature = "capture", not(target_arch = "wasm32")))]
2pub mod capture;
3
4pub mod args;
5#[cfg(any(not(feature = "capture"), target_arch = "wasm32"))]
6pub mod capture {
7    pub use crate::capture_types::{
8        CaptureFormat, CaptureRequest, CaptureStage, CaptureUnavailable, PaletteMode,
9    };
10}
11mod capture_types;
12
13pub mod environment;
14#[cfg(feature = "egui")]
15pub mod keymap;
16#[cfg(not(target_arch = "wasm32"))]
17pub mod par_native;
18pub mod script;
19pub mod session;
20pub mod trace;
21#[cfg(target_arch = "wasm32")]
22pub mod wasm;
23#[cfg(not(target_arch = "wasm32"))]
24pub mod wasm {
25    #[path = "input_queue.rs"]
26    pub mod input_queue;
27}
28
29#[cfg(feature = "egui")]
30pub use loam_egui::egui;
31pub use session::CursorPolicy;
32
33/// `Background` starts at load with no overlay and leaves keys, wheel, and page scrolling to the page.
34#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
35pub enum LaunchMode {
36    #[default]
37    Click,
38    Background,
39}
40
41/// The page sizes the canvas with CSS; otherwise the launcher pins it at its launch size.
42#[derive(Clone, Debug)]
43pub struct WasmConfig {
44    pub host_id: String,
45    pub button_id: String,
46    pub canvas_id: String,
47    pub mode: LaunchMode,
48    /// Caps the drawing buffer's width times height; `None` or `Some(0)` is no cap.
49    pub max_pixels: Option<u32>,
50}
51
52impl Default for WasmConfig {
53    fn default() -> Self {
54        Self {
55            host_id: "loam-canvas-host".into(),
56            button_id: "loam-launch".into(),
57            canvas_id: "loam-canvas".into(),
58            mode: LaunchMode::Click,
59            max_pixels: None,
60        }
61    }
62}
63
64pub(crate) const FRAME_LOOP_SECTIONS: &[&str] =
65    &["dispatch", "simulation", "publication", "presentation"];