gpui_liveplot/gpui_backend/config.rs
1/// Configuration for the GPUI plot view.
2///
3/// These values tune interaction thresholds and layout behavior for GPUI.
4#[derive(Debug, Clone)]
5pub struct PlotViewConfig {
6 /// Pixel threshold for starting a drag.
7 pub drag_threshold_px: f32,
8 /// Pixel threshold for pin hit testing.
9 pub pin_threshold_px: f32,
10 /// Pixel threshold for unpin hit testing.
11 pub unpin_threshold_px: f32,
12 /// Padding fraction applied when auto-fitting data.
13 pub padding_frac: f64,
14 /// Minimum padding applied when auto-fitting data.
15 pub min_padding: f64,
16 /// Show legend overlay.
17 pub show_legend: bool,
18 /// Show hover coordinate readout.
19 pub show_hover: bool,
20}
21
22impl Default for PlotViewConfig {
23 fn default() -> Self {
24 Self {
25 drag_threshold_px: 4.0,
26 pin_threshold_px: 12.0,
27 unpin_threshold_px: 18.0,
28 padding_frac: 0.05,
29 min_padding: 1e-6,
30 show_legend: true,
31 show_hover: true,
32 }
33 }
34}