Skip to content

Commit c5db95c

Browse files
committed
Cleanup LatLng
1 parent db4fbe0 commit c5db95c

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ module Coordinates =
3434
bounds?ne <- ne
3535
bounds |> unbox
3636

37-
38-
[<Emit("new window.google.maps.LatLngBounds()")>]
39-
let newEmptyLatLngBounds () : LatLngBounds = jsNative
4037

41-
let emptyLatLngBounds () : LatLng =
38+
let emptyLatLngBounds () : LatLngBounds =
4239
let bounds = obj()
4340
bounds |> unbox
4441

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+
4548
module Places =
4649

4750
type [<Pojo>] Geometry = {

src/Fable.ReactGoogleMaps/README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,7 @@ let markerPositions: Position list = // ...
145145
let mutable mapRef = MapRef null
146146
let onMapMounted (ref:obj) =
147147
mapRef <- MapRef ref
148-
149-
let bounds =
150-
let mutable b = ReactGoogleMaps.Coordinates.emptyLatLngBounds()
151-
for pos in markerPositions do
152-
bunds.extend pos
153-
mapRef.FitBounds bounds
148+
mapRef.FitBounds(getBoundsFromLatLngs markerPositions)
154149
155150
let myMap =
156151
googleMap [

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.2
1+
### 0.4.3
22

33
* Cleaning up map bounds
44

0 commit comments

Comments
 (0)