fix Point_to_layer

This commit is contained in:
Swrup 2022-06-20 11:04:44 +02:00
parent ede9b2076d
commit 2affa8b5fa
2 changed files with 5 additions and 3 deletions

View file

@ -85,7 +85,7 @@ let on : type kind. kind Event.sub -> (kind Event.t -> 'b) -> 'c t -> unit =
(** Geojson layers *)
type geojson_opt =
| Point_to_layer of (Jv.t -> Latlng.t -> unit)
| Point_to_layer of (Jv.t -> Latlng.t -> [ `Marker ] t)
| Style of (Jv.t -> unit)
| On_each_feature of (Jv.t -> [ `Geojson ] t -> unit)
| Filter of (Jv.t -> bool)
@ -102,7 +102,9 @@ let geojson_opt_to_string = function
let geojson_opt_to_jv = function
| Markers_inherit_options b -> Jv.of_bool b
| Point_to_layer f -> Jv.repr f
| Point_to_layer f ->
(* the marker returned by `pointToLayer` is used internally by leaflet so we neet to unwrap it to a Jv.t *)
Jv.repr (fun geojsonpoint latlng -> to_jv @@ f geojsonpoint latlng)
| Style f -> Jv.repr f
| On_each_feature f ->
(* we need to wrap the Jv.t *)

View file

@ -52,7 +52,7 @@ val on : 'a Event.sub -> ('a Event.t -> 'b) -> 'c t -> unit
(** type for geojson option, used to create geojson *)
type geojson_opt =
| Point_to_layer of (Jv.t -> Latlng.t -> unit)
| Point_to_layer of (Jv.t -> Latlng.t -> [ `Marker ] t)
| Style of (Jv.t -> unit)
| On_each_feature of (Jv.t -> [ `Geojson ] t -> unit)
| Filter of (Jv.t -> bool)