Skip to content

Commit

Permalink
Expose ClosestElem and PlotConfig (#4380)
Browse files Browse the repository at this point in the history
These two items are needed to implement the `PlotItem` trait (which is
already public) when using `PlotGeometry::Rects`.
Specifically, they are used in the return type of
`PlotItem::find_closest` and as arguments to `PlotItem::on_hover`, which
need to be implemented when using `PlotGeometry::Rects`.
  • Loading branch information
rmburg authored Apr 21, 2024
1 parent 89d7f9f commit 26c97a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions crates/egui_plot/src/items/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ use crate::*;

use super::{Cursor, LabelFormatter, PlotBounds, PlotTransform};
use rect_elem::*;
use values::ClosestElem;

pub use bar::Bar;
pub use box_elem::{BoxElem, BoxSpread};
pub use values::{LineStyle, MarkerShape, Orientation, PlotGeometry, PlotPoint, PlotPoints};
pub use values::{
ClosestElem, LineStyle, MarkerShape, Orientation, PlotGeometry, PlotPoint, PlotPoints,
};

mod bar;
mod box_elem;
Expand Down Expand Up @@ -45,7 +46,7 @@ pub trait PlotItem {

fn highlighted(&self) -> bool;

/// Can the user hover this is item?
/// Can the user hover this item?
fn allow_hover(&self) -> bool;

fn geometry(&self) -> PlotGeometry<'_>;
Expand Down
6 changes: 3 additions & 3 deletions crates/egui_plot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ use epaint::{util::FloatOrd, Hsva};
pub use crate::{
axis::{Axis, AxisHints, HPlacement, Placement, VPlacement},
items::{
Arrows, Bar, BarChart, BoxElem, BoxPlot, BoxSpread, HLine, Line, LineStyle, MarkerShape,
Orientation, PlotGeometry, PlotImage, PlotItem, PlotPoint, PlotPoints, Points, Polygon,
Text, VLine,
Arrows, Bar, BarChart, BoxElem, BoxPlot, BoxSpread, ClosestElem, HLine, Line, LineStyle,
MarkerShape, Orientation, PlotConfig, PlotGeometry, PlotImage, PlotItem, PlotPoint,
PlotPoints, Points, Polygon, Text, VLine,
},
legend::{Corner, Legend},
memory::PlotMemory,
Expand Down

0 comments on commit 26c97a1

Please sign in to comment.