From 4217f4ba7ccd0a9332796efff35995b0277748ec Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 14 Aug 2023 14:04:24 +0200 Subject: [PATCH] Add some vertical spacing --- crates/egui/src/widgets/plot/axis.rs | 3 +++ crates/egui/src/widgets/plot/memory.rs | 8 ++++++-- crates/egui/src/widgets/plot/mod.rs | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/widgets/plot/axis.rs b/crates/egui/src/widgets/plot/axis.rs index 8fbe08394..7b2a18aef 100644 --- a/crates/egui/src/widgets/plot/axis.rs +++ b/crates/egui/src/widgets/plot/axis.rs @@ -13,6 +13,7 @@ pub(super) type AxisFormatterFn = fn(f64, usize, &RangeInclusive) -> String /// Generic constant for x-Axis pub(super) const X_AXIS: usize = 0; + /// Generic constant for y-Axis pub(super) const Y_AXIS: usize = 1; @@ -29,12 +30,14 @@ pub enum Placement { // shorthand types for AxisHints, public API /// Configuration for x-axis pub type XAxisHints = AxisHints; + /// Configuration for y-axis pub type YAxisHints = AxisHints; // shorthand types for AxisWidget pub(super) type XAxisWidget = AxisWidget; pub(super) type YAxisWidget = AxisWidget; + /// Axis configuration. /// /// Used to configure axis label and ticks. diff --git a/crates/egui/src/widgets/plot/memory.rs b/crates/egui/src/widgets/plot/memory.rs index 844dcb5f6..3e47a5082 100644 --- a/crates/egui/src/widgets/plot/memory.rs +++ b/crates/egui/src/widgets/plot/memory.rs @@ -1,8 +1,8 @@ use epaint::Pos2; -use crate::{Id, Context}; +use crate::{Context, Id}; -use super::{AxisBools, transform::ScreenTransform}; +use super::{transform::ScreenTransform, AxisBools}; /// Information about the plot that has to persist between frames. #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] @@ -11,9 +11,13 @@ pub(super) struct PlotMemory { /// Indicates if the user has modified the bounds, for example by moving or zooming, /// or if the bounds should be calculated based by included point or auto bounds. pub(super) bounds_modified: AxisBools, + pub(super) hovered_entry: Option, + pub(super) hidden_items: ahash::HashSet, + pub(super) last_screen_transform: ScreenTransform, + /// Allows to remember the first click position when performing a boxed zoom pub(super) last_click_pos_for_zoom: Option, } diff --git a/crates/egui/src/widgets/plot/mod.rs b/crates/egui/src/widgets/plot/mod.rs index d03d632f9..72f7abd62 100644 --- a/crates/egui/src/widgets/plot/mod.rs +++ b/crates/egui/src/widgets/plot/mod.rs @@ -579,6 +579,7 @@ impl Plot { } self } + /// Set the y axis label of the main y-axis /// /// If no y-axis has been specified so far a new one will be created.