pub struct Camera {
pub center: Pos2,
pub zoom: f32,
}Expand description
A graph scene camera, independent of the viewport size.
Fields§
§center: Pos2The point in graph space at the centre of the view.
zoom: f32The zoom factor in screen points per graph unit. 1.0 shows one graph
unit per point (i.e. no scaling).
Implementations§
Source§impl Camera
impl Camera
Sourcepub fn to_scene_rect(self, viewport: Vec2) -> Rect
pub fn to_scene_rect(self, viewport: Vec2) -> Rect
The visible egui::Rect (in graph space) this camera maps to for a
viewport of the given size: a viewport / zoom sized rect centred on
Camera::center. egui’s Scene fits this rect back into the
viewport, reproducing exactly zoom points per graph unit.
Sourcepub fn from_scene_rect(rect: Rect, viewport: Vec2) -> Self
pub fn from_scene_rect(rect: Rect, viewport: Vec2) -> Self
Recover the camera from a scene_rect and the viewport it was fit into.
The inverse of Camera::to_scene_rect (exact when the rect shares the
viewport’s aspect ratio, which holds once egui’s Scene has fit it).
Trait Implementations§
impl Copy for Camera
Source§impl<'de> Deserialize<'de> for Camera
impl<'de> Deserialize<'de> for Camera
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Camera
Auto Trait Implementations§
impl Freeze for Camera
impl RefUnwindSafe for Camera
impl Send for Camera
impl Sync for Camera
impl Unpin for Camera
impl UnsafeUnpin for Camera
impl UnwindSafe for Camera
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
impl<T> CloneAny for T
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>,
impl<T> ErasedDestructor for Twhere
T: 'static,
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