pub struct InteractiveState {
pub pan_offset: Vec2,
pub zoom: Vec2,
pub pan_enabled: bool,
pub zoom_enabled: bool,
pub zoom_min: f32,
pub zoom_max: f32,
pub hovered_point: Option<(usize, usize)>,
pub selected_points: Vec<(usize, usize)>,
pub is_dragging: bool,
pub drag_start: Option<Vec2>,
}Expand description
Interactive state for a chart.
Fields§
§pan_offset: Vec2Pan offset in data coordinates
zoom: Vec2Zoom level (1.0 = default)
pan_enabled: boolWhether panning is enabled
zoom_enabled: boolWhether zooming is enabled
zoom_min: f32Minimum zoom level
zoom_max: f32Maximum zoom level
hovered_point: Option<(usize, usize)>Currently hovered data point (series_index, point_index)
selected_points: Vec<(usize, usize)>Selected data points
is_dragging: boolWhether the chart is being dragged
drag_start: Option<Vec2>Last mouse position during drag
Implementations§
Source§impl InteractiveState
impl InteractiveState
Sourcepub fn zoom_xy(&mut self, factor_x: f32, factor_y: f32)
pub fn zoom_xy(&mut self, factor_x: f32, factor_y: f32)
Apply independent X and Y zoom factors.
Sourcepub fn zoom_at_normalized(&mut self, normalized_center: Vec2, factor: f32)
pub fn zoom_at_normalized(&mut self, normalized_center: Vec2, factor: f32)
Apply zoom centered on a point in normalized coordinates (0-1 range within plot area).
This adjusts pan to keep the specified point visually fixed during zoom.
normalized_center should be (0.5, 0.5) for center, (0, 0) for top-left, etc.
Trait Implementations§
Source§impl Clone for InteractiveState
impl Clone for InteractiveState
Source§fn clone(&self) -> InteractiveState
fn clone(&self) -> InteractiveState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InteractiveState
impl Debug for InteractiveState
Auto Trait Implementations§
impl Freeze for InteractiveState
impl RefUnwindSafe for InteractiveState
impl Send for InteractiveState
impl Sync for InteractiveState
impl Unpin for InteractiveState
impl UnsafeUnpin for InteractiveState
impl UnwindSafe for InteractiveState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more