Set camera bounds without changing the render offset
(
&mut self,
bounds_min: DVec2,
bounds_max: DVec2,
padding_frac: f64,
)
| 136 | |
| 137 | /// Set camera bounds without changing the render offset |
| 138 | pub fn set_bounds_preserve_offset( |
| 139 | &mut self, |
| 140 | bounds_min: DVec2, |
| 141 | bounds_max: DVec2, |
| 142 | padding_frac: f64, |
| 143 | ) { |
| 144 | let size = (bounds_max - bounds_min).max(DVec2::splat(EPSILON_SMALL)); |
| 145 | let size_padded = size + size * padding_frac; |
| 146 | self.half_extents = size_padded / 2.0; |
| 147 | let center = (bounds_min + bounds_max) / 2.0; |
| 148 | self.position = center; |
| 149 | // Keep the existing render_offset |
| 150 | } |
| 151 | |
| 152 | pub(crate) fn set_bounds(&mut self, bounds_min: DVec2, bounds_max: DVec2, padding_frac: f64) { |
| 153 | let size = (bounds_max - bounds_min).max(DVec2::splat(EPSILON_SMALL)); |