add more options to tile_layer
This commit is contained in:
parent
71cdf5f97c
commit
076e3dd279
2 changed files with 63 additions and 7 deletions
53
src/layer.ml
53
src/layer.ml
|
|
@ -129,11 +129,25 @@ type tile_layer_opt =
|
|||
| Tms of bool
|
||||
| Zoom_reverse of bool
|
||||
| Detect_retina of bool
|
||||
(* TODO allow string for those two
|
||||
| (* TODO allow string for those two
|
||||
"Whether the crossOrigin attribute will be added to the tiles. If a String is provided, all tiles will have their crossOrigin attribute set to the String provided. This is needed if you want to access tile pixel data. Refer to CORS Settings for valid String values."
|
||||
*)
|
||||
| Cross_origin of bool
|
||||
Cross_origin of bool
|
||||
| Referrer_policy of bool
|
||||
| (* GridLayer options *)
|
||||
Tile_size of Point.t
|
||||
| Opacity of float
|
||||
| Update_when_idle of bool
|
||||
| Update_when_zooming of bool
|
||||
| Update_interval of int
|
||||
| Z_index of int
|
||||
| Bounds of (* LatLngBounds *) Latlng.t * Latlng.t
|
||||
| Max_native_zoom of int
|
||||
| Min_native_zoom of int
|
||||
| No_wrap of bool
|
||||
| Pane of string
|
||||
| Class_name of string
|
||||
| Keep_buffer of int
|
||||
|
||||
let tile_layer_opt_to_string = function
|
||||
| Min_zoom _ -> "minZoom"
|
||||
|
|
@ -146,17 +160,46 @@ let tile_layer_opt_to_string = function
|
|||
| Detect_retina _ -> "detectRetina"
|
||||
| Cross_origin _ -> "crossOrigin"
|
||||
| Referrer_policy _ -> "referrerPolicy"
|
||||
| Tile_size _ -> "tileSize"
|
||||
| Opacity _ -> "opacity"
|
||||
| Update_when_idle _ -> "updateWhenIdle"
|
||||
| Update_when_zooming _ -> "updateWhenZooming"
|
||||
| Update_interval _ -> "updateInterval"
|
||||
| Z_index _ -> "zIndex"
|
||||
| Bounds _ -> "bounds"
|
||||
| Max_native_zoom _ -> "maxNativeZoom"
|
||||
| Min_native_zoom _ -> "minNativeZoom"
|
||||
| No_wrap _ -> "noWrap"
|
||||
| Pane _ -> "pane"
|
||||
| Class_name _ -> "className"
|
||||
| Keep_buffer _ -> "keepBuffer"
|
||||
|
||||
let tile_layer_opt_to_jv = function
|
||||
| Min_zoom o | Max_zoom o | Zoom_offset o -> Jv.of_int o
|
||||
| Min_zoom o
|
||||
| Max_zoom o
|
||||
| Zoom_offset o
|
||||
| Update_interval o
|
||||
| Z_index o
|
||||
| Keep_buffer o
|
||||
| Min_native_zoom o
|
||||
| Max_native_zoom o ->
|
||||
Jv.of_int o
|
||||
| Tms o
|
||||
| Zoom_reverse o
|
||||
| Detect_retina o
|
||||
| Cross_origin o
|
||||
| Referrer_policy o ->
|
||||
| Referrer_policy o
|
||||
| Update_when_idle o
|
||||
| Update_when_zooming o
|
||||
| No_wrap o ->
|
||||
Jv.of_bool o
|
||||
| Error_tile_url o -> Jv.of_string o
|
||||
| Error_tile_url o | Pane o | Class_name o -> Jv.of_string o
|
||||
| Subdomains o -> Jv.of_array Jv.of_string o
|
||||
| Opacity o -> Jv.of_float o
|
||||
| Tile_size o -> Point.to_jv o
|
||||
| Bounds (a, b) ->
|
||||
(* create the actual LatlngBounds from the pair *)
|
||||
Jv.call Global.leaflet "latLngBounds" [| Latlng.to_jv a; Latlng.to_jv b |]
|
||||
|
||||
let create_tile :
|
||||
string -> attribution:string -> tile_layer_opt list -> [ `Tile ] t =
|
||||
|
|
|
|||
|
|
@ -75,6 +75,19 @@ type tile_layer_opt =
|
|||
| Detect_retina of bool
|
||||
| Cross_origin of bool
|
||||
| Referrer_policy of bool
|
||||
| Tile_size of Point.t
|
||||
| Opacity of float
|
||||
| Update_when_idle of bool
|
||||
| Update_when_zooming of bool
|
||||
| Update_interval of int
|
||||
| Z_index of int
|
||||
| Bounds of (* LatLngBounds *) Latlng.t * Latlng.t
|
||||
| Max_native_zoom of int
|
||||
| Min_native_zoom of int
|
||||
| No_wrap of bool
|
||||
| Pane of string
|
||||
| Class_name of string
|
||||
| Keep_buffer of int
|
||||
|
||||
(** [create_tile url attribution opts] create a new tile layer *)
|
||||
val create_tile :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue