Skip to content

Commit 81f84e1

Browse files
PR Feedback
Signed-off-by: Cole Gentry <peapod2007@gmail.com>
1 parent 1fd6489 commit 81f84e1

2 files changed

Lines changed: 14 additions & 9 deletions

File tree

src/app.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,12 @@ impl UltraLogApp {
13601360
}
13611361
}
13621362

1363+
/// Stop playback and reset the frame timer
1364+
fn stop_playback(&mut self) {
1365+
self.is_playing = false;
1366+
self.last_frame_time = None;
1367+
}
1368+
13631369
// ========================================================================
13641370
// Keyboard Shortcuts
13651371
// ========================================================================
@@ -1439,8 +1445,7 @@ impl UltraLogApp {
14391445

14401446
// Arrow Left - step one record backward (Shift = 10 records)
14411447
if i.key_pressed(egui::Key::ArrowLeft) {
1442-
self.is_playing = false;
1443-
self.last_frame_time = None;
1448+
self.stop_playback();
14441449
if let Some(tab_idx) = self.active_tab {
14451450
let file_index = self.tabs[tab_idx].file_index;
14461451
if file_index < self.files.len() {
@@ -1459,8 +1464,7 @@ impl UltraLogApp {
14591464

14601465
// Arrow Right - step one record forward (Shift = 10 records)
14611466
if i.key_pressed(egui::Key::ArrowRight) {
1462-
self.is_playing = false;
1463-
self.last_frame_time = None;
1467+
self.stop_playback();
14641468
if let Some(tab_idx) = self.active_tab {
14651469
let file_index = self.tabs[tab_idx].file_index;
14661470
if file_index < self.files.len() {
@@ -1479,8 +1483,7 @@ impl UltraLogApp {
14791483

14801484
// Home - jump to start of log
14811485
if i.key_pressed(egui::Key::Home) {
1482-
self.is_playing = false;
1483-
self.last_frame_time = None;
1486+
self.stop_playback();
14841487
if let Some((min, _)) = self.get_time_range() {
14851488
self.set_cursor_time(Some(min));
14861489
let record = self.find_record_at_time(min);
@@ -1491,8 +1494,7 @@ impl UltraLogApp {
14911494

14921495
// End - jump to end of log
14931496
if i.key_pressed(egui::Key::End) {
1494-
self.is_playing = false;
1495-
self.last_frame_time = None;
1497+
self.stop_playback();
14961498
if let Some((_, max)) = self.get_time_range() {
14971499
self.set_cursor_time(Some(max));
14981500
let record = self.find_record_at_time(max);

src/ui/chart.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ impl UltraLogApp {
110110
// Fixed Y bounds for normalized data (0-1 with small padding)
111111
const Y_MIN: f64 = -0.05;
112112
const Y_MAX: f64 = 1.05;
113+
/// Sensitivity multiplier for scroll-to-zoom (higher = faster zoom per scroll tick)
114+
const SCROLL_ZOOM_SENSITIVITY: f64 = 0.003;
113115

114116
// Build the plot - X-axis zoom only, Y fixed
115117
// When scroll_to_zoom is enabled, disable scroll-to-pan so we handle scroll as zoom
@@ -182,7 +184,8 @@ impl UltraLogApp {
182184
// Apply scroll-to-zoom: use scroll delta to zoom centered on pointer
183185
if scroll_to_zoom && scroll_delta_y.abs() > 0.1 {
184186
if let Some((min_t, max_t)) = time_range {
185-
let zoom_factor = (1.0 - scroll_delta_y as f64 * 0.003).clamp(0.8, 1.25);
187+
let zoom_factor =
188+
(1.0 - scroll_delta_y as f64 * SCROLL_ZOOM_SENSITIVITY).clamp(0.8, 1.25);
186189
let width = x_max - x_min;
187190
let new_width = (width * zoom_factor).clamp(0.01, max_t - min_t);
188191

0 commit comments

Comments
 (0)