mirror of
https://github.com/emilk/egui.git
synced 2026-09-02 14:50:03 -04:00
Warn on web if there are more than one viewport
This commit is contained in:
@@ -185,9 +185,14 @@ impl AppRunner {
|
|||||||
platform_output,
|
platform_output,
|
||||||
textures_delta,
|
textures_delta,
|
||||||
shapes,
|
shapes,
|
||||||
..
|
viewports,
|
||||||
|
viewport_commands: _, // TODO(emilk): handle some of the commands, like setting the title and icon
|
||||||
} = full_output;
|
} = full_output;
|
||||||
|
|
||||||
|
if viewports.len() > 1 {
|
||||||
|
log::warn!("Multiple viewports not yet supported on the web");
|
||||||
|
}
|
||||||
|
|
||||||
self.handle_platform_output(platform_output);
|
self.handle_platform_output(platform_output);
|
||||||
self.textures_delta.append(textures_delta);
|
self.textures_delta.append(textures_delta);
|
||||||
let clipped_primitives = self.egui_ctx.tessellate(shapes);
|
let clipped_primitives = self.egui_ctx.tessellate(shapes);
|
||||||
|
|||||||
@@ -668,13 +668,19 @@ pub(crate) struct ViewportState {
|
|||||||
/// Describes a viewport, i.e. a native window.
|
/// Describes a viewport, i.e. a native window.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ViewportOutput {
|
pub struct ViewportOutput {
|
||||||
pub builder: ViewportBuilder,
|
|
||||||
|
|
||||||
/// Id of us and our parent.
|
/// Id of us and our parent.
|
||||||
pub id_pair: ViewportIdPair,
|
pub id_pair: ViewportIdPair,
|
||||||
|
|
||||||
|
pub builder: ViewportBuilder,
|
||||||
|
|
||||||
/// The user-code that shows the GUI, used for deferred viewports.
|
/// The user-code that shows the GUI, used for deferred viewports.
|
||||||
///
|
///
|
||||||
/// `None` for immediate viewports and the ROOT viewport.
|
/// `None` for immediate viewports and the ROOT viewport.
|
||||||
pub viewport_ui_cb: Option<Arc<ViewportUiCallback>>,
|
pub viewport_ui_cb: Option<Arc<ViewportUiCallback>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ViewportOutput {
|
||||||
|
pub fn id(&self) -> ViewportId {
|
||||||
|
self.id_pair.this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user