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

Fixed the problem that cause a break in time space

This commit is contained in:
Konkitoman
2023-07-21 22:58:17 +03:00
parent 2b13572220
commit 0daafa0c0f
2 changed files with 7 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
use std::time::Instant;
use winit::event_loop::EventLoopWindowTarget; use winit::event_loop::EventLoopWindowTarget;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
@@ -325,6 +327,7 @@ pub fn create_storage(_app_name: &str) -> Option<Box<dyn epi::Storage>> {
pub struct EpiIntegration { pub struct EpiIntegration {
pub frame: epi::Frame, pub frame: epi::Frame,
last_auto_save: std::time::Instant, last_auto_save: std::time::Instant,
pub beagining: Instant,
pub egui_ctx: egui::Context, pub egui_ctx: egui::Context,
pending_full_output: egui::FullOutput, pending_full_output: egui::FullOutput,
/// When set, it is time to close the native window. /// When set, it is time to close the native window.
@@ -396,6 +399,7 @@ impl EpiIntegration {
window_state, window_state,
follow_system_theme: native_options.follow_system_theme, follow_system_theme: native_options.follow_system_theme,
app_icon_setter, app_icon_setter,
beagining: Instant::now(),
} }
} }
@@ -499,7 +503,8 @@ impl EpiIntegration {
self.frame.info.window_info = self.frame.info.window_info =
read_window_info(window, self.egui_ctx.pixels_per_point(), &self.window_state); read_window_info(window, self.egui_ctx.pixels_per_point(), &self.window_state);
let raw_input = egui_winit.take_egui_input(window); let mut raw_input = egui_winit.take_egui_input(window);
raw_input.time = Some(self.beagining.elapsed().as_secs_f64());
// Run user code: // Run user code:
let full_output = self.egui_ctx.run(raw_input, |egui_ctx| { let full_output = self.egui_ctx.run(raw_input, |egui_ctx| {

View File

@@ -1279,9 +1279,7 @@ impl Context {
ctx.windows.retain(|_, (builder, id, parent, used)| { ctx.windows.retain(|_, (builder, id, parent, used)| {
let out = *used; let out = *used;
if ctx.current_rendering_window == *parent || ctx.current_rendering_window == *id { if ctx.current_rendering_window == *parent || ctx.current_rendering_window == *id {
// WARNING NOT IMPLEMENTED BECAUSE THE WINDOW ONLY RENDER WHEN THE CURRENT WINDOW FRAME IS BIGGER THEN THE CURRENT FRAME *used = false;
// I DONT KNOW WHY
*used = true;
} else { } else {
} }
windows.push((*id, builder.clone())); windows.push((*id, builder.clone()));