Skip to main content

dioxus_maplibre/options/
controls.rs

1//! Control positioning and viewport padding options.
2
3use serde::{Deserialize, Serialize};
4
5/// Position of a map control on the map canvas.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
7#[serde(rename_all = "kebab-case")]
8pub enum ControlPosition {
9    TopLeft,
10    #[default]
11    TopRight,
12    BottomLeft,
13    BottomRight,
14}
15
16/// Padding values for map viewport operations.
17#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default)]
18pub struct Padding {
19    pub top: f64,
20    pub bottom: f64,
21    pub left: f64,
22    pub right: f64,
23}
24
25impl Padding {
26    pub fn uniform(value: f64) -> Self {
27        Self {
28            top: value,
29            bottom: value,
30            left: value,
31            right: value,
32        }
33    }
34}