S050: tray speed uses the held value; dialog height drift no longer repaints every frame
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
parent
06e3faab68
commit
5fb9bdf49e
2 changed files with 10 additions and 2 deletions
|
|
@ -34,6 +34,9 @@ pub struct Shell {
|
|||
watcher: Watcher,
|
||||
rx: Receiver<Do>,
|
||||
shown: Option<TrayState>,
|
||||
/// The tray speed is the same held value as the big number.
|
||||
calm: crate::ui::odometer::Calm,
|
||||
clock: std::time::Instant,
|
||||
rev: u64,
|
||||
/// What autostart was last made to match.
|
||||
autostart: (bool, bool),
|
||||
|
|
@ -53,6 +56,8 @@ impl Shell {
|
|||
watcher: Watcher::default(),
|
||||
rx,
|
||||
shown: None,
|
||||
calm: Default::default(),
|
||||
clock: std::time::Instant::now(),
|
||||
rev: u64::MAX,
|
||||
autostart: (settings.autostart, settings.start_minimised),
|
||||
quitting: false,
|
||||
|
|
@ -82,7 +87,9 @@ impl Shell {
|
|||
notes.send(&events, settings);
|
||||
}
|
||||
}
|
||||
let state = TrayState::of(shot, settings.mode);
|
||||
let mut state = TrayState::of(shot, settings.mode);
|
||||
let held = self.calm.feed(self.clock.elapsed().as_secs_f64(), shot.totals.speed);
|
||||
state.speed = (held / 1024.0).round() as u64 * 1024;
|
||||
if self.shown.as_ref() != Some(&state) {
|
||||
if let Some(tray) = &self.tray {
|
||||
tray.set(state.clone());
|
||||
|
|
|
|||
|
|
@ -227,7 +227,8 @@ impl<'a> Dialog<'a> {
|
|||
}
|
||||
});
|
||||
let height = (ui.min_rect().height() + 2.0 * pad).min(room.height());
|
||||
if known != Some(height) {
|
||||
// Half a pixel of drift between passes must not start a frame loop.
|
||||
if known.is_none_or(|k| (k - height).abs() > 0.5) {
|
||||
ctx.data_mut(|d| d.insert_temp(key, height));
|
||||
ctx.request_repaint();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue