diff options
author | Joris | 2020-07-26 18:16:59 +0200 |
---|---|---|
committer | Joris | 2020-07-26 18:16:59 +0200 |
commit | 4ee0dfae75fda3a8b6347d55c728b50ce5c210d9 (patch) | |
tree | 5f73adaf57354e0070acaa9a6b60dc49c0c48526 /src/Lib/Leaflet.ml | |
parent | 447f43995ae8d83c82d98d9d8968e90d6c4518e7 (diff) |
Allow to customize icons
Diffstat (limited to 'src/Lib/Leaflet.ml')
-rw-r--r-- | src/Lib/Leaflet.ml | 71 |
1 files changed, 59 insertions, 12 deletions
diff --git a/src/Lib/Leaflet.ml b/src/Lib/Leaflet.ml index 45e2963..a8a8978 100644 --- a/src/Lib/Leaflet.ml +++ b/src/Lib/Leaflet.ml @@ -1,35 +1,82 @@ -type map +type layer -external map : string -> map = "map" +external map : string -> layer = "map" [@@bs.val] [@@bs.scope "L"] -external setView : map -> float array -> int -> unit = "setView" +external setView : layer -> float array -> int -> unit = "setView" [@@bs.send] -type mapEvent +type event -external on : map -> string -> (mapEvent -> unit) -> unit = "on" +external on : layer -> string -> (event -> unit) -> unit = "on" [@@bs.send] -type latLng = +type lat_lng = { lat : float; lng : float; } -external latLng : mapEvent -> latLng = "latlng" +external lat_lng : event -> lat_lng = "latlng" [@@bs.get] -type addable +external target : event -> layer = "target" + [@@bs.get] + +external get_lat_lng : layer -> unit -> lat_lng = "getLatLng" + [@@bs.send] + +external title_layer : string -> layer = "tileLayer" + [@@bs.val] [@@bs.scope "L"] + +external add_layer : layer -> layer -> unit = "addLayer" + [@@bs.send] + +external clear_layers : layer -> unit = "clearLayers" + [@@bs.send] + +external remove : layer -> unit = "remove" + [@@bs.send] + +external get_layers : layer -> unit -> layer array = "getLayers" + [@@bs.send] -external tileLayer : string -> addable = "tileLayer" +(* Fit bounds *) + +external feature_group : layer array -> layer = "featureGroup" [@@bs.val] [@@bs.scope "L"] -external addTo : addable -> map -> unit = "addTo" +type bounds + +external get_bounds : layer -> unit -> bounds = "getBounds" [@@bs.send] +type fit_bounds_options = + { padding: float array + } + +external fit_bounds : layer -> bounds -> fit_bounds_options -> unit = "fitBounds" + [@@bs.send] + +(* Icon *) + +type icon + +type div_icon_input = + { className : string + ; popupAnchor : float array + ; html : Dom.element + } + +external div_icon : div_icon_input -> icon = "divIcon" + [@@bs.val] [@@bs.scope "L"] + +(* Marker *) + type markerInput = - { title : string; + { title : string + ; icon : icon + ; draggable : bool } -external marker : latLng -> markerInput -> addable = "marker" +external marker : lat_lng -> markerInput -> layer = "marker" [@@bs.val] [@@bs.scope "L"] |