Skip to content

Commit 02728a4

Browse files
committed
LatLng
1 parent 8b09942 commit 02728a4

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

src/Fable.ReactGoogleMaps/Fable.Helpers.ReactGoogleMaps.fs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,34 @@ module Coordinates =
88

99
/// GoogleMaps Position
1010
/// see https://developers.google.com/maps/documentation/javascript/reference/coordinates
11-
type IPosition =
11+
type LatLng =
1212
abstract member lat: unit -> float
1313
abstract member lng: unit -> float
1414

15+
type [<Pojo>] Position =
16+
{
17+
lat: float
18+
lng: float
19+
}
20+
interface LatLng with
21+
member this.lat() = this.lat
22+
member this.lng() = this.lng
23+
24+
1525
let newPos lat lng =
16-
{ new IPosition
17-
with
18-
member __.lat() = lat
19-
member __.lng() = lng }
26+
{ lat = lat
27+
lng = lng }
2028

2129
type [<Pojo>] Bounds = {
22-
NE : IPosition
23-
SW : IPosition
30+
NE : Position
31+
SW : Position
2432
}
2533

2634

2735
module Places =
2836

2937
type [<Pojo>] Geometry = {
30-
location: Coordinates.IPosition
38+
location: Coordinates.Position
3139
}
3240

3341
type [<Pojo>] Place = {
@@ -53,7 +61,7 @@ type MapRef(mapRef) =
5361
member __.GetZoom() : int =
5462
mapRef?getZoom() |> unbox
5563

56-
member __.GetCenter() : Coordinates.IPosition =
64+
member __.GetCenter() : Coordinates.Position =
5765
mapRef?getCenter() |> unbox
5866

5967
module Props =
@@ -84,7 +92,7 @@ module Props =
8492
| Title of string
8593
| Icon of string
8694
| OnClick of (unit -> unit)
87-
| Position of Coordinates.IPosition
95+
| Position of Coordinates.Position
8896
interface IMarkerProperties
8997

9098
type IMarkerClustererProperties =
@@ -102,11 +110,9 @@ module Props =
102110
type IMapProperties =
103111
interface end
104112

105-
106-
107113
// https://developers.google.com/maps/documentation/javascript/events#EventArguments
108114
type GoogleMapsMouseEvent =
109-
{ latLng: Coordinates.IPosition }
115+
{ latLng: Coordinates.LatLng }
110116

111117
[<RequireQualifiedAccess>]
112118
type MapProperties =
@@ -116,8 +122,8 @@ module Props =
116122
| SearchBoxText of string
117123
| ShowSearchBox of bool
118124
| ShowTrafficLayer of bool
119-
| DefaultCenter of Coordinates.IPosition
120-
| Center of Coordinates.IPosition
125+
| DefaultCenter of Coordinates.Position
126+
| Center of Coordinates.Position
121127
| OnCenterChanged of (unit -> unit)
122128
| OnPlacesChanged of (Places.Place [] -> unit)
123129
| OnZoomChanged of (unit -> unit)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
### 0.2.1
1+
### 0.2.2
22

33
* Initial release

0 commit comments

Comments
 (0)