From dbd24c54f4125c38f6aa631cfcd21475c8ce23c4 Mon Sep 17 00:00:00 2001 From: Alberto Nidasio <alberto.nidasio@skywarder.eu> Date: Mon, 13 Jan 2025 12:11:58 +0100 Subject: [PATCH] Added support for light and dark theme to PID connection lines --- src/ui/panes/pid_drawing_tool.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ui/panes/pid_drawing_tool.rs b/src/ui/panes/pid_drawing_tool.rs index 3d91ce0..9895589 100644 --- a/src/ui/panes/pid_drawing_tool.rs +++ b/src/ui/panes/pid_drawing_tool.rs @@ -57,7 +57,7 @@ impl PaneBehavior for PidPane { fn ui(&mut self, ui: &mut egui::Ui) -> PaneResponse { let theme = PidPane::find_theme(ui.ctx()); self.draw_grid(theme, ui); - self.draw_connections(ui); + self.draw_connections(theme, ui); self.draw_elements(theme, ui); // Allocate the space to sense inputs @@ -236,7 +236,7 @@ impl PidPane { } } - fn draw_connections(&self, ui: &Ui) { + fn draw_connections(&self, theme: Theme, ui: &Ui) { let painter = ui.painter(); for connection in &self.connections { @@ -260,10 +260,14 @@ impl PidPane { ); // Draw line segments + let line_color = match theme { + Theme::Light => Color32::BLACK, + Theme::Dark => Color32::WHITE, + }; for i in 0..(points.len() - 1) { let a = points[i]; let b = points[i + 1]; - painter.line_segment([a, b], PathStroke::new(1.0, Color32::GREEN)); + painter.line_segment([a, b], PathStroke::new(2.0, line_color)); } // Draw dragging boxes -- GitLab