Skip to main content

egui_plot/
cursor.rs

1use ahash::HashMap;
2use egui::Id;
3
4/// Indicates a vertical or horizontal cursor line in plot coordinates.
5#[derive(Copy, Clone, PartialEq)]
6pub enum Cursor {
7    /// Horizontal cursor line at the given y-coordinate.
8    Horizontal {
9        /// Y-coordinate of the horizontal cursor line.
10        y: f64,
11    },
12
13    /// Vertical cursor line at the given x-coordinate.
14    Vertical {
15        /// X-coordinate of the vertical cursor line.
16        x: f64,
17    },
18}
19
20/// Contains the cursors drawn for a plot widget in a single frame.
21#[derive(PartialEq, Clone)]
22pub(crate) struct PlotFrameCursors {
23    pub(crate) id: Id,
24    pub(crate) cursors: Vec<Cursor>,
25}
26
27#[derive(Default, Clone)]
28pub(crate) struct CursorLinkGroups(pub(crate) HashMap<Id, Vec<PlotFrameCursors>>);