Skip to main content

Crate dioxus_maplibre

Crate dioxus_maplibre 

Source
Expand description

§dioxus-maplibre

A MapLibre GL JS wrapper for Dioxus 0.7+

This crate provides a Map component and MapHandle API for integrating MapLibre GL JS maps into your Dioxus applications.

§Example

use dioxus::prelude::*;
use dioxus_maplibre::{Map, MapHandle, LatLng, FlyToOptions};

fn App() -> Element {
    let mut map = use_signal(|| None::<MapHandle>);

    rsx! {
        Map {
            style: "https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",
            center: LatLng::new(60.17, 24.94),
            zoom: 12.0,
            on_ready: move |handle: MapHandle| {
                map.set(Some(handle));
            },
        }
    }
}

Re-exports§

pub use components::Map;
pub use components::MapControl;
pub use components::MapControlKind;
pub use components::MapLayer;
pub use components::MapMarker;
pub use components::MapPopup;
pub use components::MapSource;
pub use components::MapSourceKind;
pub use components::use_map_handle;

Modules§

components
Map components Dioxus components and hooks for MapLibre GL JS.

Structs§

Bounds
A bounding box defined by southwest and northeast corners
EaseToOptions
Options for ease_to animation
FeatureIdentifier
Identifies a feature for feature state operations
FitBoundsOptions
Options for fit_bounds
FlyToOptions
Options for fly_to animation
FogOptions
Options for setting fog/atmosphere (passthrough to MapLibre spec)
GeoJsonSourceOptions
Options for adding a GeoJSON source
ImageSourceOptions
Options for adding an image source
JumpToOptions
Options for jump_to (instant, no animation)
LatLng
A geographic coordinate (latitude/longitude pair)
LayerClickEvent
Event fired when a feature in a layer is clicked
LayerHoverEvent
Event fired when hovering over a feature in a layer
LayerOptions
Options for adding a map layer
MapClickEvent
Event fired when the map is clicked
MapContextMenuEvent
Event fired on right-click / context menu
MapDblClickEvent
Event fired when the map is double-clicked
MapErrorEvent
Event fired when bridge reports an initialization/runtime error
MapHandle
A handle to a MapLibre map instance.
MapMoveEvent
Event fired when the map view changes (pan/zoom)
MapPitchEvent
Event fired when the pitch changes
MapPosition
Map position (center + zoom)
MapReadyEvent
Event fired when map initialization succeeds
MapRotateEvent
Event fired when the bearing (rotation) changes
MapZoomEvent
Event fired when the zoom level changes
MarkerClickEvent
Event fired when a marker is clicked
MarkerDragEndEvent
Event fired when a draggable marker is dropped after dragging
MarkerDragStartEvent
Event fired when a draggable marker starts being dragged
MarkerHoverEvent
Event fired when hovering over a marker
MarkerOptions
Options for adding a marker to the map
Padding
Padding values for map viewport operations.
Point
A point in screen pixel coordinates
PopupOptions
Options for creating a popup
QueryFeature
A feature returned by query methods (queryRenderedFeatures, querySourceFeatures)
QueryOptions
Options for querying rendered or source features
RasterDemSourceOptions
Options for adding a raster DEM source (for terrain)
RasterSourceOptions
Options for adding a raster tile source
SkyOptions
Options for setting sky (passthrough to MapLibre spec)
TerrainOptions
Options for setting terrain
VectorSourceOptions
Options for adding a vector tile source

Enums§

ControlPosition
Position of a map control on the map canvas.
MapEvent
Internal event enum for communication from JS