pub(crate) struct Camera {
pub(crate) vantage: Vantage,
pub(crate) viewport: Rect,
pub(crate) safe: Rect,
target: Option<Vantage>,
pub(crate) worked: CameraWork,
}Expand description
The session’s camera: where it stands, where it is easing to, the screen it is shown on and the part of that the chrome leaves clear.
Fields§
§vantage: Vantage§viewport: RectThe screen rect the canvas is laid out into.
safe: RectThe part of the viewport the floating chrome leaves clear, or
Rect::NOTHING where nothing has measured any.
target: Option<Vantage>Where a framing is easing to, while one is.
worked: CameraWorkImplementations§
Source§impl Camera
impl Camera
pub(crate) fn resting() -> Self
Sourcefn framing_rect(&self) -> Rect
fn framing_rect(&self) -> Rect
Where a framing centres and sizes itself: the region the chrome left, or the whole viewport where no chrome has reported any.
Sourcepub(crate) fn stand_at(&mut self, vantage: Vantage)
pub(crate) fn stand_at(&mut self, vantage: Vantage)
Stand exactly here. Any framing still easing is abandoned: what is asked for is the framing now, and letting the old one finish would walk the camera off it.
Sourcepub(crate) fn fit_to_rect(&mut self, content: Rect)
pub(crate) fn fit_to_rect(&mut self, content: Rect)
Frame content to fill the view, snapping immediately. Used for an
authored camera rect and for layer changes: the block path changed
underneath, so animating across unrelated content is jarring rather
than helpful.
Sourcepub(crate) fn fit_content(&mut self, content: Rect)
pub(crate) fn fit_content(&mut self, content: Rect)
Fit the level’s whole contents in view — the double-click gesture. Unlike
an authored camera rect this leaves a fixed FIT_BORDER_CELLS gutter
(so nothing sits against the edge) and is capped at FRAME_MAX_ZOOM
(so a nearly empty level doesn’t leap to a huge magnification).
Sourcepub(crate) fn focus_on(&mut self, content: Rect, glide: Glide)
pub(crate) fn focus_on(&mut self, content: Rect, glide: Glide)
Frame a single subject — a block picked from the navigator, the region an undo just changed — capping the zoom so a small one doesn’t blow up to fill the whole view.
Sourcepub(crate) fn bring_into_view(&mut self, content: Rect, glide: Glide)
pub(crate) fn bring_into_view(&mut self, content: Rect, glide: Glide)
Bring content into view with the gentlest move that reaches it:
nothing at all when it is already visible, otherwise a pan — the zoom
is only touched for content that cannot fit at this one. What a paste
lands is content the viewer has never seen, so the alternative to this
is content that arrives off-screen and reads as having not arrived.
fn frame_rect(&mut self, content: Rect, max_zoom: Zoom, glide: Glide)
fn glide_to(&mut self, vantage: Vantage, glide: Glide)
Sourcepub(crate) fn ease(&mut self, dt: Duration) -> bool
pub(crate) fn ease(&mut self, dt: Duration) -> bool
Advance a framing in progress by one frame that took dt, easing
toward the target with a frame-rate-independent exponential approach.
Answers whether it is still under way — a host that draws on demand
asks for another frame while it is.
Sourcepub(crate) fn moved(&mut self, moved: Move)
pub(crate) fn moved(&mut self, moved: Move)
What the host’s pointer did to the camera. Manual control, so it cancels a framing in progress and names the undo entry.
fn zoom_about(&mut self, factor: Factor, anchor: Pos2)
Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.