1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 21:00:03 -04:00

Warn on web if there are more than one viewport

This commit is contained in:
Emil Ernerfeldt
2023-11-12 11:41:49 +01:00
parent e1f261b079
commit 111228bc4b
2 changed files with 14 additions and 3 deletions

View File

@@ -185,9 +185,14 @@ impl AppRunner {
platform_output,
textures_delta,
shapes,
..
viewports,
viewport_commands: _, // TODO(emilk): handle some of the commands, like setting the title and icon
} = full_output;
if viewports.len() > 1 {
log::warn!("Multiple viewports not yet supported on the web");
}
self.handle_platform_output(platform_output);
self.textures_delta.append(textures_delta);
let clipped_primitives = self.egui_ctx.tessellate(shapes);

View File

@@ -668,13 +668,19 @@ pub(crate) struct ViewportState {
/// Describes a viewport, i.e. a native window.
#[derive(Clone)]
pub struct ViewportOutput {
pub builder: ViewportBuilder,
/// Id of us and our parent.
pub id_pair: ViewportIdPair,
pub builder: ViewportBuilder,
/// The user-code that shows the GUI, used for deferred viewports.
///
/// `None` for immediate viewports and the ROOT viewport.
pub viewport_ui_cb: Option<Arc<ViewportUiCallback>>,
}
impl ViewportOutput {
pub fn id(&self) -> ViewportId {
self.id_pair.this
}
}