Skip to main content

ImageSliceStyle

Struct ImageSliceStyle 

Source
pub struct ImageSliceStyle {
    pub window_sensitivity: f64,
    pub level_sensitivity: f64,
    pub slice_scroll_step: f64,
    /* private fields */
}
Expand description

Image-slice interaction style.

Maintains an internal WindowLevel that the consumer can read after each event via ImageSliceStyle::window_level.

Slice scrolling is communicated through a slice_delta value that the consumer should read and apply to its crate::reslice::SlicePlane.

Fields§

§window_sensitivity: f64

Pixels per unit of window width change (default 4.0).

§level_sensitivity: f64

Pixels per unit of window center change (default 2.0).

§slice_scroll_step: f64

World units per scroll tick for slicing (default 1.0).

Implementations§

Source§

impl ImageSliceStyle

Source

pub fn new(window_level: WindowLevel) -> Self

Create with default sensitivities and the given initial window/level.

Source

pub fn window_level(&self) -> WindowLevel

The current window/level (updated by drag events).

Source

pub fn take_slice_delta(&mut self) -> f64

Consume and return the accumulated slice translation since the last call.

The consumer should apply this to its SlicePlane::offset_along_normal.

Trait Implementations§

Source§

impl Debug for ImageSliceStyle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl InteractionStyle for ImageSliceStyle

Source§

fn on_mouse_event( &mut self, event: &MouseEvent, _ctx: &InteractionContext, camera: &mut Camera, ) -> InteractionResult

Handle a mouse event and potentially mutate the camera. Read more
Source§

fn on_key_event( &mut self, _event: &KeyEvent, _ctx: &InteractionContext, _camera: &mut Camera, ) -> InteractionResult

Handle a key event.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.