mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-08 17:40:54 +00:00
Menus: the wasm build has no unused import warning for menu_open
The only callers of `menus::menu_open` are the native palette-window code in `panel_docking.rs` and its native tests, so on wasm32 the re-export and the function were unused and `cargo xtask wasm` printed two warnings for them. Both now carry `#[cfg(not(target_arch = "wasm32"))]`. The menu bar still records whether a menu is open on every target.
This commit is contained in:
@@ -58,6 +58,7 @@ mod tree;
|
||||
mod ui_commands;
|
||||
|
||||
pub use bar::menu_bar;
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) use bar::menu_open;
|
||||
pub(crate) use bar::{home_key, home_showing};
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -68,6 +68,7 @@ fn menu_open_id() -> egui::Id {
|
||||
}
|
||||
|
||||
/// Whether a menu of the in-window menu bar is open (`false` when no menu bar was drawn yet).
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
pub(crate) fn menu_open(ctx: &egui::Context) -> bool {
|
||||
ctx.data(|d| d.get_temp::<bool>(menu_open_id())).unwrap_or(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user