Struct bevy_trackball::TrackballInput
source · pub struct TrackballInput {Show 28 fields
pub velocity: TrackballVelocity,
pub wheel_unit: TrackballWheelUnit,
pub focus: bool,
pub gamer_key: Option<KeyCode>,
pub ortho_key: Option<KeyCode>,
pub reset_key: Option<KeyCode>,
pub first_button: Option<MouseButton>,
pub first_key: Option<KeyCode>,
pub first_left_key: Option<KeyCode>,
pub first_right_key: Option<KeyCode>,
pub first_up_key: Option<KeyCode>,
pub first_down_key: Option<KeyCode>,
pub orbit_button: Option<MouseButton>,
pub screw_left_key: Option<KeyCode>,
pub screw_right_key: Option<KeyCode>,
pub orbit_left_key: Option<KeyCode>,
pub orbit_right_key: Option<KeyCode>,
pub orbit_up_key: Option<KeyCode>,
pub orbit_down_key: Option<KeyCode>,
pub slide_button: Option<MouseButton>,
pub slide_left_key: Option<KeyCode>,
pub slide_right_key: Option<KeyCode>,
pub slide_up_key: Option<KeyCode>,
pub slide_down_key: Option<KeyCode>,
pub slide_far_key: Option<KeyCode>,
pub slide_near_key: Option<KeyCode>,
pub scale_in_key: Option<KeyCode>,
pub scale_out_key: Option<KeyCode>,
}
Expand description
Trackball controller input mappings and settings.
Fields§
§velocity: TrackballVelocity
Trackball velocity for time-based input like pressed keys.
wheel_unit: TrackballWheelUnit
Wheel unit for coherent scaling. Default is 24 clicks per turn.
Device dependent setting as mouse wheel events usually lack a reference unit.
focus: bool
Enables focus operation. Default is true
.
Whether to slide towards mouse or single-finger touch position when Self::orbit_button
is just pressed and released again or single-finger gesture is just started and ended again.
Moving the cursor/finger slightly between pressed/started and released/ended events discards
the focus operation in favor of the orbit operation.
gamer_key: Option<KeyCode>
Key used to toggle esdf
/wasd
mapping. Default is KeyCode::KeyM
.
ortho_key: Option<KeyCode>
Key used to toggle projection mode. Default is KeyCode::KeyP
.
reset_key: Option<KeyCode>
Key used to reset frame. Default is KeyCode::Enter
.
Mouse button used to look around. Default is MouseButton::Middle
.
first_key: Option<KeyCode>
Key used to look around with single-finger touch. Default is KeyCode::ShiftLeft
.
first_left_key: Option<KeyCode>
Key used to look left. Default is KeyCode::ArrowLeft
.
first_right_key: Option<KeyCode>
Key used to look right. Default is KeyCode::ArrowRight
.
first_up_key: Option<KeyCode>
Key used to look up. Default is KeyCode::ArrowUp
.
first_down_key: Option<KeyCode>
Key used to look down. Default is KeyCode::ArrowDown
.
Mouse button used to orbit camera. Default is MouseButton::Left
.
screw_left_key: Option<KeyCode>
Key used to screw/roll left. Default is KeyCode::KeyU
.
screw_right_key: Option<KeyCode>
Key used to screw/roll right. Default is KeyCode::KeyO
.
orbit_left_key: Option<KeyCode>
Key used to orbit left. Default is KeyCode::KeyJ
.
orbit_right_key: Option<KeyCode>
Key used to orbit right. Default is KeyCode::KeyL
.
orbit_up_key: Option<KeyCode>
Key used to orbit up. Default is KeyCode::KeyI
.
orbit_down_key: Option<KeyCode>
Key used to orbit down. Default is KeyCode::KeyK
.
Mouse button used to slide camera. Default is MouseButton::Right
.
slide_left_key: Option<KeyCode>
Key used to slide left. Default is KeyCode::KeyS
.
slide_right_key: Option<KeyCode>
Key used to slide right. Default is KeyCode::KeyF
.
slide_up_key: Option<KeyCode>
Key used to slide up. Default is KeyCode::KeyE
.
slide_down_key: Option<KeyCode>
Key used to slide up. Default is KeyCode::KeyD
.
slide_far_key: Option<KeyCode>
Key used to slide far. Default is KeyCode::KeyG
.
slide_near_key: Option<KeyCode>
Key used to slide near. Default is KeyCode::KeyV
.
scale_in_key: Option<KeyCode>
Key used to scale/zoom in. Default is KeyCode::KeyH
.
scale_out_key: Option<KeyCode>
Key used to scale/zoom out. Default is KeyCode::KeyN
.
Implementations§
source§impl TrackballInput
impl TrackballInput
sourcepub fn map_esdf(&mut self)
pub fn map_esdf(&mut self)
Maps esdf
/gv
to slide operations.
Key | Operation |
---|---|
e | Slides up. |
s | Slides left. |
d | Slides down. |
f | Slides right. |
g | Slides far (in/forward). |
v | Slides near (out/backward). |
This mapping is symmetric to the ijkl
/hn
orbit mapping but less intuitive to gamers
compared with Self::map_wasd
.
sourcepub fn map_wasd(&mut self)
pub fn map_wasd(&mut self)
Maps wasd
/Space
/ControlLeft
to slide operations.
Key | Operation |
---|---|
w | Slides far (in/forward). |
a | Slides left. |
s | Slides near (out/backward). |
d | Slides right. |
Space | Slides up (jump). |
ControlLeft | Slides down (crouch). |
This mapping isn’t symmetric to the ijkl
/hn
orbit mapping but more intuitive to gamers
compared with Self::map_esdf
.
Trait Implementations§
source§impl Clone for TrackballInput
impl Clone for TrackballInput
source§fn clone(&self) -> TrackballInput
fn clone(&self) -> TrackballInput
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Component for TrackballInput
impl Component for TrackballInput
source§const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = bevy::ecs::component::StorageType::Table
source§fn register_component_hooks(_hooks: &mut ComponentHooks)
fn register_component_hooks(_hooks: &mut ComponentHooks)
ComponentHooks
.source§impl Debug for TrackballInput
impl Debug for TrackballInput
Auto Trait Implementations§
impl Freeze for TrackballInput
impl RefUnwindSafe for TrackballInput
impl Send for TrackballInput
impl Sync for TrackballInput
impl Unpin for TrackballInput
impl UnwindSafe for TrackballInput
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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
source§impl<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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>
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>
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)
&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)
&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<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
fn get_components(self, func: &mut impl FnMut(StorageType, OwningPtr<'_>))
source§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Self
using data from the given World
.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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.