Skip to content

Commit 1eeb844

Browse files
committed
Merge branch 'missing-map-stuff' of https://github.com/nojaf/fable-react
2 parents 89f161a + 244ea0a commit 1eeb844

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ type MapRef(mapRef) =
5555

5656
module Props =
5757

58-
5958
type IInfoWindowProperties =
6059
interface end
6160

@@ -99,6 +98,15 @@ module Props =
9998

10099
type IMapProperties =
101100
interface end
101+
102+
// https://developers.google.com/maps/documentation/javascript/reference/coordinates
103+
type LatLng =
104+
abstract member lat: unit -> float
105+
abstract member lng: unit -> float
106+
107+
// https://developers.google.com/maps/documentation/javascript/events#EventArguments
108+
type GoogleMapsMouseEvent =
109+
{ latLng: LatLng }
102110

103111
[<RequireQualifiedAccess>]
104112
type MapProperties =
@@ -114,9 +122,11 @@ module Props =
114122
| OnPlacesChanged of (Places.Place [] -> unit)
115123
| OnZoomChanged of (unit -> unit)
116124
| OnIdle of (unit -> unit)
117-
| Markers of React.ReactElement
125+
| OnClick of (GoogleMapsMouseEvent -> unit)
126+
| Markers of React.ReactElement list
118127
| MapLoadingContainer of string
119128
| MapContainer of string
129+
| Options of obj
120130
interface IMapProperties
121131
let InfoWindow: RCom = import "InfoWindow" "react-google-maps"
122132

src/Fable.ReactGoogleMaps/mapComponent.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ const TrafficMapComponent = withScriptjs(withGoogleMap((props) => {
4747
onZoomChanged : props.onZoomChanged,
4848
onIdle : props.onIdle,
4949
defaultCenter : props.defaultCenter,
50+
onClick: props.onClick,
5051
center : props.center,
52+
options: props.options,
5153
ref : props.onMapMounted },
5254
childs))
5355
}));
@@ -84,7 +86,8 @@ export class GoogleMapComponent extends React.PureComponent {
8486
searchBoxText: this.props.searchBoxText,
8587
showSearchBox: this.props.showSearchBox,
8688
showTrafficLayer: this.props.showTrafficLayer,
87-
center: this.props.center,
89+
center: this.props.center,
90+
options: this.props.options,
8891
onPlacesChanged: () => {
8992
this.props.onPlacesChanged(this.searchBoxRef.getPlaces())
9093
},
@@ -97,7 +100,8 @@ export class GoogleMapComponent extends React.PureComponent {
97100
onMarkerClick: () => {
98101
this.setState({ isMarkerShown: false })
99102
this.delayedShowMarker()
100-
},
103+
},
104+
onClick: this.props.onClick,
101105
googleMapURL: "https://maps.googleapis.com/maps/api/js?key=" + this.props.apiKey + "&v=3.exp&libraries=geometry,drawing,places",
102106
loadingElement: loading,
103107
containerElement: container,

0 commit comments

Comments
 (0)