mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Now App::update will be responsabile for what viewport will be drawned and its content
A big refactoring was needed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
use eframe::{
|
||||
egui::{Button, CentralPanel, Context, UserAttentionType},
|
||||
egui::{Button, CentralPanel, Context, UserAttentionType, ViewportRender},
|
||||
CreationContext, NativeOptions,
|
||||
};
|
||||
|
||||
@@ -54,7 +54,16 @@ impl Application {
|
||||
}
|
||||
|
||||
impl eframe::App for Application {
|
||||
fn update(&mut self, ctx: &Context, frame: &mut eframe::Frame) {
|
||||
fn update(
|
||||
&mut self,
|
||||
ctx: &Context,
|
||||
frame: &mut eframe::Frame,
|
||||
render: Option<&ViewportRender>,
|
||||
) {
|
||||
if let Some(render) = render {
|
||||
render(ctx, frame.viewport_id(), frame.parent_viewport_id());
|
||||
return;
|
||||
}
|
||||
if let Some(request_at) = self.request_at {
|
||||
if request_at < SystemTime::now() {
|
||||
self.request_at = None;
|
||||
|
||||
Reference in New Issue
Block a user