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

Method size_px

src/series.rs:131–144  ·  view source on GitHub ↗
(size: f32, size_mode: u32, camera: &Camera, bounds: &Rectangle)

Source from the content-addressed store, hash-verified

129 }
130 }
131 pub(crate) fn size_px(size: f32, size_mode: u32, camera: &Camera, bounds: &Rectangle) -> f32 {
132 if size_mode != crate::point::MARKER_SIZE_WORLD {
133 return size;
134 }
135 let width = bounds.width.max(1.0) as f64;
136 let height = bounds.height.max(1.0) as f64;
137 let world_per_px_x = (2.0 * camera.half_extents.x) / width;
138 let world_per_px_y = (2.0 * camera.half_extents.y) / height;
139 let world_per_px_x = world_per_px_x.max(1e-12);
140 let world_per_px_y = world_per_px_y.max(1e-12);
141 let px_x = size as f64 / world_per_px_x;
142 let px_y = size as f64 / world_per_px_y;
143 px_x.max(px_y) as f32
144 }
145 pub(crate) fn to_px(self, camera: &Camera, bounds: &Rectangle) -> f32 {
146 let (size, size_mode) = self.to_raw();
147 Self::size_px(size, size_mode, camera, bounds)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected