`Plot::Items:allow_hover` give possibility to masked the interaction on hovered item (#2558)
This is particularly interesting if you want to authorize a single hover tooltip on an item in the event of an interaction. --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
parent
570e7cf71b
commit
9fa8aa7e30
|
|
@ -45,6 +45,9 @@ pub trait PlotItem {
|
||||||
|
|
||||||
fn highlighted(&self) -> bool;
|
fn highlighted(&self) -> bool;
|
||||||
|
|
||||||
|
/// Can the user hover this is item?
|
||||||
|
fn allow_hover(&self) -> bool;
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_>;
|
fn geometry(&self) -> PlotGeometry<'_>;
|
||||||
|
|
||||||
fn bounds(&self) -> PlotBounds;
|
fn bounds(&self) -> PlotBounds;
|
||||||
|
|
@ -121,6 +124,7 @@ pub struct HLine {
|
||||||
pub(super) stroke: Stroke,
|
pub(super) stroke: Stroke,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
pub(super) style: LineStyle,
|
pub(super) style: LineStyle,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
@ -132,6 +136,7 @@ impl HLine {
|
||||||
stroke: Stroke::new(1.0, Color32::TRANSPARENT),
|
stroke: Stroke::new(1.0, Color32::TRANSPARENT),
|
||||||
name: String::default(),
|
name: String::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
style: LineStyle::Solid,
|
style: LineStyle::Solid,
|
||||||
id: None,
|
id: None,
|
||||||
}
|
}
|
||||||
|
|
@ -144,6 +149,13 @@ impl HLine {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a stroke.
|
/// Add a stroke.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
||||||
|
|
@ -233,6 +245,10 @@ impl PlotItem for HLine {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::None
|
PlotGeometry::None
|
||||||
}
|
}
|
||||||
|
|
@ -256,6 +272,7 @@ pub struct VLine {
|
||||||
pub(super) stroke: Stroke,
|
pub(super) stroke: Stroke,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
pub(super) style: LineStyle,
|
pub(super) style: LineStyle,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
@ -267,6 +284,7 @@ impl VLine {
|
||||||
stroke: Stroke::new(1.0, Color32::TRANSPARENT),
|
stroke: Stroke::new(1.0, Color32::TRANSPARENT),
|
||||||
name: String::default(),
|
name: String::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
style: LineStyle::Solid,
|
style: LineStyle::Solid,
|
||||||
id: None,
|
id: None,
|
||||||
}
|
}
|
||||||
|
|
@ -279,6 +297,13 @@ impl VLine {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a stroke.
|
/// Add a stroke.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
||||||
|
|
@ -368,6 +393,10 @@ impl PlotItem for VLine {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::None
|
PlotGeometry::None
|
||||||
}
|
}
|
||||||
|
|
@ -390,6 +419,7 @@ pub struct Line {
|
||||||
pub(super) stroke: Stroke,
|
pub(super) stroke: Stroke,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
pub(super) fill: Option<f32>,
|
pub(super) fill: Option<f32>,
|
||||||
pub(super) style: LineStyle,
|
pub(super) style: LineStyle,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
|
|
@ -402,6 +432,7 @@ impl Line {
|
||||||
stroke: Stroke::new(1.5, Color32::TRANSPARENT), // Note: a stroke of 1.0 (or less) can look bad on low-dpi-screens
|
stroke: Stroke::new(1.5, Color32::TRANSPARENT), // Note: a stroke of 1.0 (or less) can look bad on low-dpi-screens
|
||||||
name: Default::default(),
|
name: Default::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
fill: None,
|
fill: None,
|
||||||
style: LineStyle::Solid,
|
style: LineStyle::Solid,
|
||||||
id: None,
|
id: None,
|
||||||
|
|
@ -415,6 +446,13 @@ impl Line {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a stroke.
|
/// Add a stroke.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
||||||
|
|
@ -558,6 +596,10 @@ impl PlotItem for Line {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::Points(self.series.points())
|
PlotGeometry::Points(self.series.points())
|
||||||
}
|
}
|
||||||
|
|
@ -577,6 +619,7 @@ pub struct Polygon {
|
||||||
pub(super) stroke: Stroke,
|
pub(super) stroke: Stroke,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
pub(super) fill_color: Option<Color32>,
|
pub(super) fill_color: Option<Color32>,
|
||||||
pub(super) style: LineStyle,
|
pub(super) style: LineStyle,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
|
|
@ -589,6 +632,7 @@ impl Polygon {
|
||||||
stroke: Stroke::new(1.0, Color32::TRANSPARENT),
|
stroke: Stroke::new(1.0, Color32::TRANSPARENT),
|
||||||
name: Default::default(),
|
name: Default::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
fill_color: None,
|
fill_color: None,
|
||||||
style: LineStyle::Solid,
|
style: LineStyle::Solid,
|
||||||
id: None,
|
id: None,
|
||||||
|
|
@ -603,6 +647,13 @@ impl Polygon {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a custom stroke.
|
/// Add a custom stroke.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
pub fn stroke(mut self, stroke: impl Into<Stroke>) -> Self {
|
||||||
|
|
@ -697,6 +748,10 @@ impl PlotItem for Polygon {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::Points(self.series.points())
|
PlotGeometry::Points(self.series.points())
|
||||||
}
|
}
|
||||||
|
|
@ -717,6 +772,7 @@ pub struct Text {
|
||||||
pub(super) position: PlotPoint,
|
pub(super) position: PlotPoint,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
pub(super) color: Color32,
|
pub(super) color: Color32,
|
||||||
pub(super) anchor: Align2,
|
pub(super) anchor: Align2,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
|
|
@ -729,6 +785,7 @@ impl Text {
|
||||||
position,
|
position,
|
||||||
name: Default::default(),
|
name: Default::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
color: Color32::TRANSPARENT,
|
color: Color32::TRANSPARENT,
|
||||||
anchor: Align2::CENTER_CENTER,
|
anchor: Align2::CENTER_CENTER,
|
||||||
id: None,
|
id: None,
|
||||||
|
|
@ -742,6 +799,13 @@ impl Text {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Text color.
|
/// Text color.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn color(mut self, color: impl Into<Color32>) -> Self {
|
pub fn color(mut self, color: impl Into<Color32>) -> Self {
|
||||||
|
|
@ -822,6 +886,10 @@ impl PlotItem for Text {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::None
|
PlotGeometry::None
|
||||||
}
|
}
|
||||||
|
|
@ -856,6 +924,8 @@ pub struct Points {
|
||||||
|
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
|
|
||||||
pub(super) stems: Option<f32>,
|
pub(super) stems: Option<f32>,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
@ -870,6 +940,7 @@ impl Points {
|
||||||
radius: 1.0,
|
radius: 1.0,
|
||||||
name: Default::default(),
|
name: Default::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
stems: None,
|
stems: None,
|
||||||
id: None,
|
id: None,
|
||||||
}
|
}
|
||||||
|
|
@ -889,6 +960,13 @@ impl Points {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Set the marker's color.
|
/// Set the marker's color.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn color(mut self, color: impl Into<Color32>) -> Self {
|
pub fn color(mut self, color: impl Into<Color32>) -> Self {
|
||||||
|
|
@ -1087,6 +1165,10 @@ impl PlotItem for Points {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::Points(self.series.points())
|
PlotGeometry::Points(self.series.points())
|
||||||
}
|
}
|
||||||
|
|
@ -1108,6 +1190,7 @@ pub struct Arrows {
|
||||||
pub(super) color: Color32,
|
pub(super) color: Color32,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1120,6 +1203,7 @@ impl Arrows {
|
||||||
color: Color32::TRANSPARENT,
|
color: Color32::TRANSPARENT,
|
||||||
name: Default::default(),
|
name: Default::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
id: None,
|
id: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1131,6 +1215,13 @@ impl Arrows {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Set the length of the arrow tips
|
/// Set the length of the arrow tips
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn tip_length(mut self, tip_length: f32) -> Self {
|
pub fn tip_length(mut self, tip_length: f32) -> Self {
|
||||||
|
|
@ -1232,6 +1323,10 @@ impl PlotItem for Arrows {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::Points(self.origins.points())
|
PlotGeometry::Points(self.origins.points())
|
||||||
}
|
}
|
||||||
|
|
@ -1256,6 +1351,7 @@ pub struct PlotImage {
|
||||||
pub(super) bg_fill: Color32,
|
pub(super) bg_fill: Color32,
|
||||||
pub(super) tint: Color32,
|
pub(super) tint: Color32,
|
||||||
pub(super) highlight: bool,
|
pub(super) highlight: bool,
|
||||||
|
pub(super) allow_hover: bool,
|
||||||
pub(super) name: String,
|
pub(super) name: String,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
@ -1271,6 +1367,7 @@ impl PlotImage {
|
||||||
position: center_position,
|
position: center_position,
|
||||||
name: Default::default(),
|
name: Default::default(),
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
texture_id: texture_id.into(),
|
texture_id: texture_id.into(),
|
||||||
uv: Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)),
|
uv: Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)),
|
||||||
size: size.into(),
|
size: size.into(),
|
||||||
|
|
@ -1288,6 +1385,13 @@ impl PlotImage {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Select UV range. Default is (0,0) in top-left, (1,1) bottom right.
|
/// Select UV range. Default is (0,0) in top-left, (1,1) bottom right.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn uv(mut self, uv: impl Into<Rect>) -> Self {
|
pub fn uv(mut self, uv: impl Into<Rect>) -> Self {
|
||||||
|
|
@ -1407,6 +1511,10 @@ impl PlotItem for PlotImage {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::None
|
PlotGeometry::None
|
||||||
}
|
}
|
||||||
|
|
@ -1443,6 +1551,7 @@ pub struct BarChart {
|
||||||
pub(super) element_formatter: Option<Box<dyn Fn(&Bar, &BarChart) -> String>>,
|
pub(super) element_formatter: Option<Box<dyn Fn(&Bar, &BarChart) -> String>>,
|
||||||
|
|
||||||
highlight: bool,
|
highlight: bool,
|
||||||
|
allow_hover: bool,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1455,6 +1564,7 @@ impl BarChart {
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
element_formatter: None,
|
element_formatter: None,
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
id: None,
|
id: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1523,6 +1633,13 @@ impl BarChart {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a custom way to format an element.
|
/// Add a custom way to format an element.
|
||||||
/// Can be used to display a set number of decimals or custom labels.
|
/// Can be used to display a set number of decimals or custom labels.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
@ -1591,6 +1708,10 @@ impl PlotItem for BarChart {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::Rects
|
PlotGeometry::Rects
|
||||||
}
|
}
|
||||||
|
|
@ -1636,6 +1757,7 @@ pub struct BoxPlot {
|
||||||
pub(super) element_formatter: Option<Box<dyn Fn(&BoxElem, &BoxPlot) -> String>>,
|
pub(super) element_formatter: Option<Box<dyn Fn(&BoxElem, &BoxPlot) -> String>>,
|
||||||
|
|
||||||
highlight: bool,
|
highlight: bool,
|
||||||
|
allow_hover: bool,
|
||||||
id: Option<Id>,
|
id: Option<Id>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1648,6 +1770,7 @@ impl BoxPlot {
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
element_formatter: None,
|
element_formatter: None,
|
||||||
highlight: false,
|
highlight: false,
|
||||||
|
allow_hover: true,
|
||||||
id: None,
|
id: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1709,6 +1832,13 @@ impl BoxPlot {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Allowed hovering this item in the plot. Default: `true`.
|
||||||
|
#[inline]
|
||||||
|
pub fn allow_hover(mut self, hovering: bool) -> Self {
|
||||||
|
self.allow_hover = hovering;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
/// Add a custom way to format an element.
|
/// Add a custom way to format an element.
|
||||||
/// Can be used to display a set number of decimals or custom labels.
|
/// Can be used to display a set number of decimals or custom labels.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
|
@ -1752,6 +1882,10 @@ impl PlotItem for BoxPlot {
|
||||||
self.highlight
|
self.highlight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn allow_hover(&self) -> bool {
|
||||||
|
self.allow_hover
|
||||||
|
}
|
||||||
|
|
||||||
fn geometry(&self) -> PlotGeometry<'_> {
|
fn geometry(&self) -> PlotGeometry<'_> {
|
||||||
PlotGeometry::Rects
|
PlotGeometry::Rects
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1649,12 +1649,15 @@ impl PreparedPlot {
|
||||||
|
|
||||||
let interact_radius_sq = (16.0_f32).powi(2);
|
let interact_radius_sq = (16.0_f32).powi(2);
|
||||||
|
|
||||||
let candidates = items.iter().filter_map(|item| {
|
let candidates = items
|
||||||
let item = &**item;
|
.iter()
|
||||||
let closest = item.find_closest(pointer, transform);
|
.filter(|entry| entry.allow_hover())
|
||||||
|
.filter_map(|item| {
|
||||||
|
let item = &**item;
|
||||||
|
let closest = item.find_closest(pointer, transform);
|
||||||
|
|
||||||
Some(item).zip(closest)
|
Some(item).zip(closest)
|
||||||
});
|
});
|
||||||
|
|
||||||
let closest = candidates
|
let closest = candidates
|
||||||
.min_by_key(|(_, elem)| elem.dist_sq.ord())
|
.min_by_key(|(_, elem)| elem.dist_sq.ord())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue