mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
Add a new example and change how embedding is stored
This commit is contained in:
@@ -214,7 +214,7 @@ pub trait App {
|
||||
// NOTE: a bright gray makes the shadows of the windows look weird.
|
||||
// We use a bit of transparency so that if the user switches on the
|
||||
// `transparent()` option they get immediate results.
|
||||
egui::Color32::from_rgba_unmultiplied(12, 12, 12, 180).to_normalized_gamma_f32()
|
||||
egui::Color32::from_rgba_unmultiplied(12, 12, 12, 0).to_normalized_gamma_f32()
|
||||
|
||||
// _visuals.window_fill() would also be a natural choice
|
||||
}
|
||||
|
||||
@@ -517,11 +517,7 @@ impl EpiIntegration {
|
||||
// Run user code:
|
||||
let full_output = self.egui_ctx.run(raw_input, |egui_ctx| {
|
||||
crate::profile_scope!("App::update");
|
||||
if let Some(render) = render {
|
||||
(render.as_ref())(egui_ctx, viewport_id, parent_id)
|
||||
} else {
|
||||
app.update(egui_ctx, &mut self.frame, render.as_ref().map(|r| &***r));
|
||||
}
|
||||
app.update(egui_ctx, &mut self.frame, render.as_ref().map(|r| &***r));
|
||||
});
|
||||
|
||||
self.pending_full_output.append(full_output);
|
||||
|
||||
@@ -1065,7 +1065,12 @@ mod glow_integration {
|
||||
let screen_size_in_pixels: [u32; 2] =
|
||||
win.window.as_ref().unwrap().inner_size().into();
|
||||
|
||||
egui_glow::painter::clear(&gl, screen_size_in_pixels, [0.0, 0.0, 0.0, 0.0]);
|
||||
win.window.as_mut().unwrap().set_transparent(true);
|
||||
egui_glow::painter::clear(
|
||||
&gl,
|
||||
screen_size_in_pixels,
|
||||
app.clear_color(&integration.egui_ctx.style().visuals),
|
||||
);
|
||||
|
||||
integration.egui_ctx.set_current_viewport_id(win.window_id);
|
||||
egui::FullOutput {
|
||||
|
||||
@@ -175,7 +175,6 @@ pub struct Window<'open> {
|
||||
collapsible: bool,
|
||||
default_open: bool,
|
||||
with_title_bar: bool,
|
||||
embedded: bool,
|
||||
window_builder: ViewportBuilder,
|
||||
}
|
||||
|
||||
@@ -200,7 +199,6 @@ impl<'open> Window<'open> {
|
||||
collapsible: true,
|
||||
default_open: true,
|
||||
with_title_bar: true,
|
||||
embedded: false,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,11 +413,6 @@ impl<'open> Window<'open> {
|
||||
self.area = self.area.drag_bounds(bounds);
|
||||
self
|
||||
}
|
||||
|
||||
pub fn embedded(mut self, value: bool) -> Self {
|
||||
self.embedded = value;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'open> Window<'open> {
|
||||
@@ -449,10 +442,12 @@ impl<'open> Window<'open> {
|
||||
collapsible,
|
||||
default_open,
|
||||
with_title_bar,
|
||||
embedded,
|
||||
mut window_builder,
|
||||
} = self;
|
||||
|
||||
let embedded =
|
||||
ctx.data_mut(|data| *data.get_persisted_mut_or(area.id.with("_embedded"), false));
|
||||
|
||||
let is_open = if let Some(open) = &mut open {
|
||||
if let Some(tmp_open) = ctx.data_mut(|data| {
|
||||
let tmp = data.get_persisted::<bool>(area.id.with("_open"));
|
||||
|
||||
Reference in New Issue
Block a user