improvements 2

This commit is contained in:
2026-05-24 20:01:01 +02:00
parent 9855f68e7f
commit e4fea66df6
3 changed files with 42 additions and 8 deletions
+6 -6
View File
@@ -255,6 +255,11 @@ pub fn decode(dbc: &Dbc,
// println!("{:?}", unknown_ids); // println!("{:?}", unknown_ids);
// println!("{:?}", error_frames); // println!("{:?}", error_frames);
for (_, frames) in &mut data {
// frames.voracious_mt_sort(thread_count);
frames.voracious_sort();
}
DecodeResult { DecodeResult {
data, data,
metadata, metadata,
@@ -274,7 +279,7 @@ pub fn decode_to_motec(dbc: &Dbc,
asc_path: &Path, asc_path: &Path,
output_dir: &Path) -> DecodeProcessInfo { output_dir: &Path) -> DecodeProcessInfo {
let DecodeResult { let DecodeResult {
mut data, data,
metadata, metadata,
info, info,
} = decode(dbc, asc_path); } = decode(dbc, asc_path);
@@ -285,11 +290,6 @@ pub fn decode_to_motec(dbc: &Dbc,
.and_utc() .and_utc()
.to_rfc3339_opts(chrono::SecondsFormat::Secs, true); .to_rfc3339_opts(chrono::SecondsFormat::Secs, true);
for (_, frames) in &mut data {
// frames.voracious_mt_sort(thread_count);
frames.voracious_sort();
}
let msgs: Vec<MessageMetadata> = metadata.values().cloned().collect(); let msgs: Vec<MessageMetadata> = metadata.values().cloned().collect();
// println!("Messages: {}", msgs.len()); // println!("Messages: {}", msgs.len());
+35 -1
View File
@@ -1,7 +1,7 @@
use eframe::egui; use eframe::egui;
use egui::ecolor::Hsva; use egui::ecolor::Hsva;
use egui::{Color32, Vec2b}; use egui::{Color32, Vec2b};
use egui_plot::{AxisHints, Legend, Line, Plot, PlotPoint, PlotPoints, VPlacement}; use egui_plot::{AxisHints, Legend, Line, Plot, PlotBounds, PlotPoint, PlotPoints, VPlacement};
use crate::plot_list::{majority_unit, PlotGroup}; use crate::plot_list::{majority_unit, PlotGroup};
use crate::signal::{decimate, nearest_y, PlottedSignal}; use crate::signal::{decimate, nearest_y, PlottedSignal};
@@ -62,6 +62,39 @@ fn line_label(sig: &PlottedSignal, cursor_x: Option<f64>) -> String {
} }
} }
/// Clamp the visible x-range to [0, x_max]. Preserves the current zoom
/// width when possible; if the zoomed-out width exceeds the data range,
/// just snaps to the full range.
fn clamp_x_bounds(plot_ui: &mut egui_plot::PlotUi, x_max: f64) {
let bounds = plot_ui.plot_bounds();
let lo = bounds.min();
let hi = bounds.max();
let mut new_lo_x = lo[0];
let mut new_hi_x = hi[0];
let width = new_hi_x - new_lo_x;
if width >= x_max {
new_lo_x = 0.0;
new_hi_x = x_max;
} else {
if new_lo_x < 0.0 {
new_lo_x = 0.0;
new_hi_x = new_lo_x + width;
}
if new_hi_x > x_max {
new_hi_x = x_max;
new_lo_x = new_hi_x - width;
}
}
if new_lo_x != lo[0] || new_hi_x != hi[0] {
plot_ui.set_plot_bounds(PlotBounds::from_min_max(
[new_lo_x, lo[1]],
[new_hi_x, hi[1]],
));
}
}
pub fn show_plot_panel( pub fn show_plot_panel(
ui: &mut egui::Ui, ui: &mut egui::Ui,
plots: &[PlotGroup], plots: &[PlotGroup],
@@ -112,6 +145,7 @@ pub fn show_plot_panel(
]); ]);
let response = plot.show(ui, |plot_ui| { let response = plot.show(ui, |plot_ui| {
clamp_x_bounds(plot_ui, full_max);
if plot_group.signals.is_empty() { if plot_group.signals.is_empty() {
plot_ui.line( plot_ui.line(
Line::new( Line::new(
+1 -1
View File
@@ -92,7 +92,7 @@ pub fn show_dbc_tree(
.desired_width(f32::INFINITY), .desired_width(f32::INFINITY),
); );
let needle = filter.trim(); let needle = filter.trim();
let matcher = SkimMatcherV2::default(); let matcher = SkimMatcherV2::default().ignore_case();
ScrollArea::both() ScrollArea::both()
.scroll([true, true]) .scroll([true, true])
.scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::VisibleWhenNeeded) .scroll_bar_visibility(egui::scroll_area::ScrollBarVisibility::VisibleWhenNeeded)