Skip to content

Commit f1f709b

Browse files
committed
Document MapRef
1 parent 0b46752 commit f1f709b

File tree

3 files changed

+31
-10
lines changed

3 files changed

+31
-10
lines changed

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@ module Coordinates =
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-
15+
type [<Pojo>] Position = {
16+
lat: float
17+
lng: float
18+
}
2419

2520
let newPos lat lng =
2621
{ lat = lat

src/Fable.ReactGoogleMaps/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,29 @@ let myMap =
9292
// ..
9393
MapProperties.Clusterer clustered ]
9494
```
95+
96+
97+
## Getting properties from the map
98+
99+
It's possible to retrieve properties like current center or current bounds from the GoogleMaps component. You need to use a MapRef like the following:
100+
101+
```fs
102+
103+
let mutable mapRef = MapRef null
104+
let setMapRef (ref:obj) =
105+
mapRef <- MapRef ref
106+
107+
// ...
108+
109+
110+
let myMap =
111+
googleMap [
112+
MapProperties.ApiKey googleMapApiKey
113+
// ..
114+
MapProperties.SetRef setMapRef ]
115+
116+
// ...
117+
118+
let bounds = mapRef.GetBounds()
119+
120+
```
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
### 0.3.0
1+
### 0.3.1
22

33
* Initial release

0 commit comments

Comments
 (0)