Skip to content

Commit db4fbe0

Browse files
committed
Cleanup LatLng
1 parent 2ffec4a commit db4fbe0

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,36 @@ module Coordinates =
1212
abstract member lat: unit -> float
1313
abstract member lng: unit -> float
1414

15-
[<Emit("new window.google.maps.LatLng($0, $1)")>]
16-
let newLatLng (lat: float, lng: float) : LatLng = jsNative
15+
let newLatLng (lat: float, lng: float) : LatLng =
16+
let pos = obj()
17+
pos?lat <- lat
18+
pos?lng <- lng
19+
pos |> unbox
1720

1821

1922
// https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLngBounds
2023

2124
type LatLngBounds =
2225
abstract member extend : LatLngBounds -> LatLngBounds
2326
abstract member extend : LatLng -> LatLngBounds
24-
25-
[<Emit("new window.google.maps.LatLngBounds($0, $1)")>]
26-
let newLatLngBounds (sw: LatLng, ne: LatLng) : LatLngBounds = jsNative
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
2736

2837

2938
[<Emit("new window.google.maps.LatLngBounds()")>]
3039
let newEmptyLatLngBounds () : LatLngBounds = jsNative
3140

41+
let emptyLatLngBounds () : LatLng =
42+
let bounds = obj()
43+
bounds |> unbox
44+
3245
module Places =
3346

3447
type [<Pojo>] Geometry = {

src/Fable.ReactGoogleMaps/Fable.ReactGoogleMaps.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project Sdk="Microsoft.NET.Sdk">
33
<PropertyGroup>
4-
<Version>0.4.0</Version>
4+
<Version>0.4.2</Version>
55
<TargetFramework>netstandard2.0</TargetFramework>
66
<GenerateDocumentationFile>true</GenerateDocumentationFile>
77
</PropertyGroup>

src/Fable.ReactGoogleMaps/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ let onMapMounted (ref:obj) =
147147
mapRef <- MapRef ref
148148
149149
let bounds =
150-
let mutable b = ReactGoogleMaps.Coordinates.newEmptyLatLngBounds()
150+
let mutable b = ReactGoogleMaps.Coordinates.emptyLatLngBounds()
151151
for pos in markerPositions do
152152
bunds.extend pos
153153
mapRef.FitBounds bounds

src/Fable.ReactGoogleMaps/RELEASE_NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### 0.4.1
1+
### 0.4.2
22

33
* Cleaning up map bounds
44

0 commit comments

Comments
 (0)