runmat_plot/gui/
window.rs1#[derive(Debug, Clone)]
8pub struct WindowConfig {
9 pub title: String,
10 pub width: u32,
11 pub height: u32,
12 pub resizable: bool,
13 pub maximized: bool,
14 pub vsync: bool,
15}
16
17impl Default for WindowConfig {
18 fn default() -> Self {
19 Self {
20 title: "RunMat - Interactive Visualization | Powered by Dystr".to_string(),
21 width: 1200,
22 height: 800,
23 resizable: true,
24 maximized: false,
25 vsync: true,
26 }
27 }
28}
29
30#[cfg(feature = "gui")]
32pub struct PlotWindow<'window> {
33 pub window: std::sync::Arc<winit::window::Window>,
34 pub event_loop: Option<winit::event_loop::EventLoop<()>>,
35 pub plot_renderer: crate::core::PlotRenderer,
36 pub plot_overlay: crate::gui::PlotOverlay,
37 pub surface: wgpu::Surface<'window>,
38 pub depth_texture: wgpu::Texture,
39 pub depth_view: wgpu::TextureView,
40 pub egui_ctx: egui::Context,
41 pub egui_state: egui_winit::State,
42 pub egui_renderer: egui_wgpu::Renderer,
43 pub config: WindowConfig,
44 pub mouse_position: glam::Vec2,
45 pub is_mouse_over_plot: bool,
46 pub needs_initial_redraw: bool,
48 pub pixels_per_point: f32,
50 pub mouse_left_down: bool,
52 pub active_drag_axes: Option<usize>,
54 pub close_signal: Option<std::sync::Arc<std::sync::atomic::AtomicBool>>,
56}
57
58#[cfg(not(feature = "gui"))]
62pub struct PlotWindow;
63
64#[cfg(not(feature = "gui"))]
65impl PlotWindow {
66 pub async fn new(_config: WindowConfig) -> Result<Self, Box<dyn std::error::Error>> {
67 Err("GUI feature not enabled".into())
68 }
69
70 pub fn add_test_plot(&mut self) {
71 }
73
74 pub fn run(self) -> Result<(), Box<dyn std::error::Error>> {
75 Err("GUI feature not enabled".into())
76 }
77
78 pub fn install_close_signal(&mut self, _signal: std::sync::Arc<std::sync::atomic::AtomicBool>) {
79 }
81}