dioxus_leaflet/types/
map_position.rs

1use serde::{Deserialize, Serialize};
2use crate::LatLng;
3
4/// Represents a geographical position with zoom level
5#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
6pub struct MapPosition {
7    pub coordinates: LatLng,
8    pub zoom: f64,
9}
10
11impl MapPosition {
12    /// Creates a new MapPosition
13    pub const fn new(lat: f64, lng: f64, zoom: f64) -> Self {
14        Self { coordinates: LatLng::new(lat, lng), zoom }
15    }
16}
17
18impl Default for MapPosition {
19    fn default() -> Self {
20        Self::new(51.505, -0.09, 13.0)
21    }
22}