You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're using ctx.request_repaint_after() to schedule an update, but have found a very surprising behavior where egui doesn't wait as long as requested, resulting in premature callbacks, causing many surprising unnecessary updates. For now, we've hacked a workaround (see below) by setting RawInput::predicted_dt to 0 in raw_input_hook().
Is there a way to disable it, rather than work around it?
Separately, is the behavior documented anywhere?
Also, should this be disabled in reactive mode (and maybe in continuous mode--it's pretty likely to not guess right and cause extra repaints, IIUC)?
Thanks!
impl eframe::AppforIotasoftUiApp{fnraw_input_hook(&mutself,_ctx:&egui::Context,raw_input:&mut egui::RawInput){
raw_input.predicted_dt = 0.0;// work around undocumented request_repaint_after() behavior that silently causes premature updates}fnupdate(&mutself,ctx:&egui::Context,_frame:&mut eframe::Frame){self.manage_polling();// polls hardware, then sets self.next_poll_time
...rendering code ...
let now = Instant::now();if now >= self.next_poll_time{self.ctx.request_repaint();}else{let poll_remaining_time = self.next_poll_time - now;self.ctx.request_repaint_after(poll_remaining_time);}}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
We're using
ctx.request_repaint_after()
to schedule an update, but have found a very surprising behavior whereegui
doesn't wait as long as requested, resulting in premature callbacks, causing many surprising unnecessary updates. For now, we've hacked a workaround (see below) by settingRawInput::predicted_dt
to0
inraw_input_hook()
.Is there a way to disable it, rather than work around it?
Separately, is the behavior documented anywhere?
Also, should this be disabled in reactive mode (and maybe in continuous mode--it's pretty likely to not guess right and cause extra repaints, IIUC)?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions