Skip to content

Commit 7b7f6a6

Browse files
committed
Allow reset of plot display ratio with double click
1 parent 67b578c commit 7b7f6a6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/gui.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,16 +370,19 @@ impl MyApp {
370370
self.plot_location = plot_inner.response.rect;
371371
}
372372
let separator_response = ui.separator();
373-
let resize_y = ui
373+
let separator = ui
374374
.interact(
375375
separator_response.rect,
376376
separator_response.id,
377377
Sense::click_and_drag(),
378378
)
379-
.on_hover_cursor(egui::CursorIcon::ResizeVertical)
380-
.drag_delta()
381-
.y;
379+
.on_hover_cursor(egui::CursorIcon::ResizeVertical);
382380

381+
let resize_y = separator.drag_delta().y;
382+
383+
if separator.double_clicked() {
384+
self.plot_serial_display_ratio = 0.45;
385+
}
383386
self.plot_serial_display_ratio = (self.plot_serial_display_ratio
384387
+ resize_y / panel_height)
385388
.clamp(0.1, 0.9);

0 commit comments

Comments
 (0)