Skip to main content

InteractionStyle

Trait InteractionStyle 

Source
pub trait InteractionStyle: Send + Sync {
    // Required methods
    fn on_mouse_event(
        &mut self,
        event: &MouseEvent,
        ctx: &InteractionContext,
        camera: &mut Camera,
    ) -> InteractionResult;
    fn on_key_event(
        &mut self,
        event: &KeyEvent,
        ctx: &InteractionContext,
        camera: &mut Camera,
    ) -> InteractionResult;
}
Expand description

An interaction style drives a Camera in response to abstract input events.

§VTK Equivalent

vtkInteractorStyle — specifically vtkInteractorStyleTrackballCamera and vtkInteractorStyleImage.

Required Methods§

Source

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

Handle a mouse event and potentially mutate the camera.

Returns an InteractionResult describing what changed so the consumer knows whether to trigger a re-render.

Source

fn on_key_event( &mut self, event: &KeyEvent, ctx: &InteractionContext, camera: &mut Camera, ) -> InteractionResult

Handle a key event.

Implementors§