dioxus_maplibre/handle/
popups.rs1#![allow(clippy::needless_pass_by_value)]
3
4use super::MapHandle;
5use crate::options::PopupOptions;
6use crate::types::LatLng;
7
8impl MapHandle {
9 pub fn add_popup(&self, id: &str, position: LatLng, html: &str, options: PopupOptions) {
11 self.fire_and_forget(|| {
12 let json = serde_json::to_string(&options).unwrap_or_default();
13 crate::interop::add_popup_js(&self.map_id, id, position.lat, position.lng, html, &json)
14 });
15 }
16
17 pub fn remove_popup(&self, id: &str) {
19 self.fire_and_forget(|| crate::interop::remove_popup_js(&self.map_id, id));
20 }
21}