@@ -3,58 +3,7 @@ module Fable.Helpers.ReactGoogleMaps
33open Fable.Core
44open Fable.Import
55open Fable.Core .JsInterop
6-
7- module Coordinates =
8-
9- /// GoogleMaps Position
10- /// see https://developers.google.com/maps/documentation/javascript/reference/coordinates
11- type LatLng =
12- abstract member lat: unit -> float
13- abstract member lng: unit -> float
14-
15- let newLatLng ( lat : float , lng : float ) : LatLng =
16- let pos = obj()
17- pos?lat <- lat
18- pos?lng <- lng
19- pos |> unbox
20-
21-
22- // https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLngBounds
23-
24- type LatLngBounds =
25- abstract member extend : LatLngBounds -> LatLngBounds
26- abstract member extend : LatLng -> LatLngBounds
27- abstract member getSouthWest : unit -> LatLng
28- abstract member getNorthEast : unit -> LatLng
29-
30-
31- let newLatLngBounds ( sw : LatLng , ne : LatLng ) : LatLng =
32- let bounds = obj()
33- bounds?sw <- sw
34- bounds?ne <- ne
35- bounds |> unbox
36-
37-
38- let emptyLatLngBounds () : LatLngBounds =
39- let bounds = obj()
40- bounds |> unbox
41-
42- let getBoundsFromLatLngs ( positions : LatLng seq ) : LatLngBounds =
43- let mutable b = emptyLatLngBounds()
44- for pos in positions do
45- b <- b.extend pos
46- b
47-
48- module Places =
49-
50- type [<Pojo>] Geometry = {
51- location: Coordinates .LatLng
52- }
53-
54- type [<Pojo>] Place = {
55- geometry: Geometry
56- }
57-
6+ open Google.Maps
587
598module R = Fable.Helpers.React
609
@@ -63,7 +12,7 @@ type RCom = React.ComponentClass<obj>
6312type MapRef ( mapRef ) =
6413
6514 /// Get the current bounds of the Map
66- member __.GetBounds () : Coordinates. LatLngBounds option =
15+ member __.GetBounds () : LatLngBounds option =
6716 if isNull mapRef then
6817 None
6918 else
@@ -76,13 +25,13 @@ type MapRef(mapRef) =
7625 Some( mapRef?getZoom() |> unbox)
7726
7827
79- member __.GetCenter () : Coordinates. LatLng option =
28+ member __.GetCenter () : LatLng option =
8029 if isNull mapRef then
8130 None
8231 else
8332 Some( mapRef?getCenter() |> unbox)
8433
85- member __.FitBounds ( bounds : Coordinates. LatLngBounds, ? padding : float ) : unit =
34+ member __.FitBounds ( bounds : LatLngBounds , ? padding : float ) : unit =
8635 if not ( isNull mapRef) then
8736 mapRef?fitBounds( bounds, padding) |> ignore
8837
@@ -114,7 +63,7 @@ module Props =
11463 | Title of string
11564 | Icon of string
11665 | OnClick of ( unit -> unit )
117- | Position of Coordinates. LatLng
66+ | Position of LatLng
11867 interface IMarkerProperties
11968
12069 type IMarkerClustererProperties =
@@ -132,9 +81,6 @@ module Props =
13281 type IMapProperties =
13382 interface end
13483
135- // https://developers.google.com/maps/documentation/javascript/events#EventArguments
136- type GoogleMapsMouseEvent =
137- { latLng: Coordinates .LatLng }
13884
13985 [<RequireQualifiedAccess>]
14086 type MapProperties =
@@ -144,13 +90,13 @@ module Props =
14490 | SearchBoxText of string
14591 | ShowSearchBox of bool
14692 | ShowTrafficLayer of bool
147- | DefaultCenter of Coordinates. LatLng
148- | Center of Coordinates. LatLng
93+ | DefaultCenter of LatLng
94+ | Center of LatLng
14995 | OnCenterChanged of ( unit -> unit )
150- | OnPlacesChanged of ( Places. Place [] -> unit )
96+ | OnPlacesChanged of ( Place [] -> unit )
15197 | OnZoomChanged of ( unit -> unit )
15298 | OnIdle of ( unit -> unit )
153- | OnClick of ( GoogleMapsMouseEvent -> unit )
99+ | OnClick of ( MouseEvent -> unit )
154100 | Markers of React.ReactElement seq
155101 | [<CompiledName( " Markers" ) >] Clusterer of React.ReactElement
156102 | MapLoadingContainer of string
0 commit comments