pub struct Camera { /* private fields */ }Expand description
A 2D camera that can be zoomed and panned.
Implementations§
Source§impl PanZoomCamera2d
impl PanZoomCamera2d
Sourcepub fn new(eye: Vec2, zoom: f32) -> PanZoomCamera2d
pub fn new(eye: Vec2, zoom: f32) -> PanZoomCamera2d
Create a new arc-ball camera.
Sourcepub fn set_at(&mut self, at: Vec2)
pub fn set_at(&mut self, at: Vec2)
Get a mutable reference to the point the camera is looking at.
Sourcepub fn set_zoom_step(&mut self, new_zoom_step: f32)
pub fn set_zoom_step(&mut self, new_zoom_step: f32)
Sets the zoom step of the camera.
Sourcepub fn look_at(&mut self, at: Vec2, zoom: f32)
pub fn look_at(&mut self, at: Vec2, zoom: f32)
Move the camera such that it is centered on a specific point.
The button used to drag the PanZoomCamera2d camera.
Set the button used to drag the PanZoomCamera2d camera. Use None to disable dragging.
Sourcepub fn drag_modifier(&self) -> Option<Modifiers>
pub fn drag_modifier(&self) -> Option<Modifiers>
The modifier used to drag the PanZoomCamera2d camera.
Sourcepub fn rebind_drag_modifier(&mut self, new_modifier: Option<Modifiers>)
pub fn rebind_drag_modifier(&mut self, new_modifier: Option<Modifiers>)
Set the modifier used to drag the PanZoomCamera2d camera.
Sourcepub fn zoom_modifier(&self) -> Option<Modifiers>
pub fn zoom_modifier(&self) -> Option<Modifiers>
The modifier used to zoom the PanZoomCamera2d camera.
Sourcepub fn rebind_zoom_modifier(&mut self, new_modifier: Option<Modifiers>)
pub fn rebind_zoom_modifier(&mut self, new_modifier: Option<Modifiers>)
Set the modifier used to zoom the PanZoomCamera2d camera.
Trait Implementations§
Source§impl Camera2d for PanZoomCamera2d
impl Camera2d for PanZoomCamera2d
Source§fn unproject(&self, window_coord: Vec2, size: Vec2) -> Vec2
fn unproject(&self, window_coord: Vec2, size: Vec2) -> Vec2
Calculate the global position of the given window coordinate
Source§fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
fn handle_event(&mut self, canvas: &Canvas, event: &WindowEvent)
Handles window events to update camera state. Read more
Source§impl Clone for PanZoomCamera2d
impl Clone for PanZoomCamera2d
Source§fn clone(&self) -> PanZoomCamera2d
fn clone(&self) -> PanZoomCamera2d
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for PanZoomCamera2d
Source§impl Debug for PanZoomCamera2d
impl Debug for PanZoomCamera2d
Source§impl Default for PanZoomCamera2d
impl Default for PanZoomCamera2d
Source§fn default() -> PanZoomCamera2d
fn default() -> PanZoomCamera2d
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PanZoomCamera2d
impl<'de> Deserialize<'de> for PanZoomCamera2d
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PanZoomCamera2d, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PanZoomCamera2d, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PanZoomCamera2d
impl PartialEq for PanZoomCamera2d
Source§fn eq(&self, other: &PanZoomCamera2d) -> bool
fn eq(&self, other: &PanZoomCamera2d) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for PanZoomCamera2d
impl Serialize for PanZoomCamera2d
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for PanZoomCamera2d
Auto Trait Implementations§
impl Freeze for PanZoomCamera2d
impl RefUnwindSafe for PanZoomCamera2d
impl Send for PanZoomCamera2d
impl Sync for PanZoomCamera2d
impl Unpin for PanZoomCamera2d
impl UnsafeUnpin for PanZoomCamera2d
impl UnwindSafe for PanZoomCamera2d
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn 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>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which 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)
Converts
&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)
Converts
&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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().impl<T> Scalar for T
impl<T> SerializableAny for T
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.