@@ -6,25 +6,28 @@ open Fable.Core.JsInterop
66
77module Coordinates =
88
9- type [<Pojo>] Position = {
10- lat: float
11- lng: float
12- }
9+ /// GoogleMaps Position
10+ /// see https://developers.google.com/maps/documentation/javascript/reference/coordinates
11+ type IPosition =
12+ abstract member lat: unit -> float
13+ abstract member lng: unit -> float
1314
1415 let newPos lat lng =
15- { lat = lat
16- lng = lng }
16+ { new IPosition
17+ with
18+ member __.lat () = lat
19+ member __.lng () = lng }
1720
1821 type [<Pojo>] Bounds = {
19- NE : Position
20- SW : Position
22+ NE : IPosition
23+ SW : IPosition
2124 }
2225
2326
2427module Places =
2528
2629 type [<Pojo>] Geometry = {
27- location: Coordinates .Position
30+ location: Coordinates .IPosition
2831 }
2932
3033 type [<Pojo>] Place = {
@@ -50,7 +53,7 @@ type MapRef(mapRef) =
5053 member __.GetZoom () : int =
5154 mapRef?getZoom() |> unbox
5255
53- member __.GetCenter () : Coordinates.Position =
56+ member __.GetCenter () : Coordinates.IPosition =
5457 mapRef?getCenter() |> unbox
5558
5659module Props =
@@ -81,7 +84,7 @@ module Props =
8184 | Title of string
8285 | Icon of string
8386 | OnClick of ( unit -> unit )
84- | Position of Coordinates.Position
87+ | Position of Coordinates.IPosition
8588 interface IMarkerProperties
8689
8790 type IMarkerClustererProperties =
@@ -99,14 +102,11 @@ module Props =
99102 type IMapProperties =
100103 interface end
101104
102- // https://developers.google.com/maps/documentation/javascript/reference/coordinates
103- type LatLng =
104- abstract member lat: unit -> float
105- abstract member lng: unit -> float
105+
106106
107107 // https://developers.google.com/maps/documentation/javascript/events#EventArguments
108108 type GoogleMapsMouseEvent =
109- { latLng: LatLng }
109+ { latLng: Coordinates . IPosition }
110110
111111 [<RequireQualifiedAccess>]
112112 type MapProperties =
@@ -116,8 +116,8 @@ module Props =
116116 | SearchBoxText of string
117117 | ShowSearchBox of bool
118118 | ShowTrafficLayer of bool
119- | DefaultCenter of Coordinates.Position
120- | Center of Coordinates.Position
119+ | DefaultCenter of Coordinates.IPosition
120+ | Center of Coordinates.IPosition
121121 | OnCenterChanged of ( unit -> unit )
122122 | OnPlacesChanged of ( Places.Place [] -> unit )
123123 | OnZoomChanged of ( unit -> unit )
0 commit comments