MCPcopy Create free account
hub / github.com/donkeyteethUX/iced_plot / new

Method new

src/camera.rs:61–71  ·  view source on GitHub ↗
(width: u32, height: u32)

Source from the content-addressed store, hash-verified

59
60impl Camera {
61 pub(crate) fn new(width: u32, height: u32) -> Self {
62 const INITIAL_ZOOM: f64 = 1.0;
63 let aspect = width as f64 / height as f64;
64 let half_height = INITIAL_ZOOM;
65 let half_width = aspect * half_height;
66 Self {
67 position: DVec2::ZERO,
68 half_extents: DVec2::new(half_width, half_height),
69 render_offset: DVec2::ZERO,
70 }
71 }
72
73 pub(crate) fn build_view_projection_matrix(&self) -> Mat4 {
74 let proj = Mat4::orthographic_rh(

Callers

nothing calls this directly

Calls 1

newFunction · 0.50

Tested by

no test coverage detected