cleanup Marker
This commit is contained in:
parent
65ee38b4ee
commit
25f51e0417
2 changed files with 9 additions and 10 deletions
|
|
@ -3,7 +3,7 @@ include Layer
|
||||||
|
|
||||||
type t = [ `Marker ] Layer.t
|
type t = [ `Marker ] Layer.t
|
||||||
|
|
||||||
type marker_opt =
|
type opt =
|
||||||
| Icon of Icon.t
|
| Icon of Icon.t
|
||||||
| Keyboard of bool
|
| Keyboard of bool
|
||||||
| Title of string
|
| Title of string
|
||||||
|
|
@ -17,7 +17,7 @@ type marker_opt =
|
||||||
| Bubbling_mouse_events of bool
|
| Bubbling_mouse_events of bool
|
||||||
| Auto_pan_on_focus of bool
|
| Auto_pan_on_focus of bool
|
||||||
|
|
||||||
let marker_opt_to_string : marker_opt -> string = function
|
let opt_to_string : opt -> string = function
|
||||||
| Icon _ -> "icon"
|
| Icon _ -> "icon"
|
||||||
| Keyboard _ -> "keyboard"
|
| Keyboard _ -> "keyboard"
|
||||||
| Title _ -> "title"
|
| Title _ -> "title"
|
||||||
|
|
@ -31,7 +31,7 @@ let marker_opt_to_string : marker_opt -> string = function
|
||||||
| Bubbling_mouse_events _ -> "bubblingMouseEvents"
|
| Bubbling_mouse_events _ -> "bubblingMouseEvents"
|
||||||
| Auto_pan_on_focus _ -> "autoPanOnFocus"
|
| Auto_pan_on_focus _ -> "autoPanOnFocus"
|
||||||
|
|
||||||
let marker_opt_to_jv = function
|
let opt_to_jv = function
|
||||||
| Icon icon -> Icon.to_jv icon
|
| Icon icon -> Icon.to_jv icon
|
||||||
| Keyboard b | Rise_on_hover b | Bubbling_mouse_events b | Auto_pan_on_focus b
|
| Keyboard b | Rise_on_hover b | Bubbling_mouse_events b | Auto_pan_on_focus b
|
||||||
->
|
->
|
||||||
|
|
@ -40,11 +40,10 @@ let marker_opt_to_jv = function
|
||||||
| Z_index_offset i | Rise_offset i -> Jv.of_int i
|
| Z_index_offset i | Rise_offset i -> Jv.of_int i
|
||||||
| Opacity f -> Jv.of_float f
|
| Opacity f -> Jv.of_float f
|
||||||
|
|
||||||
let create_marker : Latlng.t -> marker_opt list -> t =
|
let create : Latlng.t -> opt list -> t =
|
||||||
fun latlng options ->
|
fun latlng options ->
|
||||||
let l =
|
let l =
|
||||||
Array.of_list
|
Array.of_list @@ List.map (fun o -> (opt_to_string o, opt_to_jv o)) options
|
||||||
@@ List.map (fun o -> (marker_opt_to_string o, marker_opt_to_jv o)) options
|
|
||||||
in
|
in
|
||||||
let jv_t =
|
let jv_t =
|
||||||
Jv.call Global.leaflet "marker" [| Latlng.to_jv latlng; Jv.obj l |]
|
Jv.call Global.leaflet "marker" [| Latlng.to_jv latlng; Jv.obj l |]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
type t = [ `Marker ] Layer.t
|
type t = [ `Marker ] Layer.t
|
||||||
|
|
||||||
(** type for marker option, used to create marker *)
|
(** type for marker option, used to create marker *)
|
||||||
type marker_opt =
|
type opt =
|
||||||
| Icon of Icon.t
|
| Icon of Icon.t
|
||||||
| Keyboard of bool
|
| Keyboard of bool
|
||||||
| Title of string
|
| Title of string
|
||||||
|
|
@ -15,9 +15,9 @@ type marker_opt =
|
||||||
| Bubbling_mouse_events of bool
|
| Bubbling_mouse_events of bool
|
||||||
| Auto_pan_on_focus of bool
|
| Auto_pan_on_focus of bool
|
||||||
|
|
||||||
(** [create_marker latlng options] is a new marker with the same position as
|
(** [create latlng options] is a new marker with the same position as [latlng]
|
||||||
[latlng] and with options set to [options] *)
|
and with options set to [options] *)
|
||||||
val create_marker : Latlng.t -> marker_opt list -> t
|
val create : Latlng.t -> opt list -> t
|
||||||
|
|
||||||
(** Returns the current geographical position of the marker. *)
|
(** Returns the current geographical position of the marker. *)
|
||||||
val get_latlng : t -> Latlng.t
|
val get_latlng : t -> Latlng.t
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue