maplibre/context.rs
1use crate::{
2 render::{view_state::ViewState, Renderer},
3 style::Style,
4 tcs::world::World,
5 window::PhysicalSize,
6};
7
8/// Stores the context of the map.
9///
10/// This struct should not depend on the [`crate::environment::Environment`] trait. Else types
11/// throughout the crate get messy quickly.
12pub struct MapContext {
13 pub style: Style,
14 pub world: World,
15 pub view_state: ViewState,
16 pub renderer: Renderer,
17}
18
19impl MapContext {
20 pub fn resize(&mut self, size: PhysicalSize, scale_factor: f64) {
21 self.view_state.resize(size.to_logical(scale_factor));
22 self.renderer.resize_surface(size)
23 }
24}