forked from fullstackreact/google-maps-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic.js
More file actions
61 lines (52 loc) · 1.26 KB
/
Copy pathbasic.js
File metadata and controls
61 lines (52 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import React from 'react'
import ReactDOM from 'react-dom'
import Map, {GoogleApiWrapper} from '../../src/index'
const Container = React.createClass({
getInitialState: function() {
return {
showingInfoWindow: false,
activeMarker: {},
selectedPlace: {},
}
},
onMapMoved: function(props, map) {
const center = map.center;
},
onMarkerClick: function(props, marker, e) {
this.setState({
selectedPlace: props,
activeMarker: marker,
showingInfoWindow: true
});
},
onInfoWindowClose: function() {
this.setState({
showingInfoWindow: false,
activeMarker: null
})
},
onMapClicked: function(props) {
if (this.state.showingInfoWindow) {
this.setState({
showingInfoWindow: false,
activeMarker: null
})
}
},
render: function() {
if (!this.props.loaded) {
return <div>Loading...</div>
}
return (
<Map google={this.props.google}
style={{width: '100%', height: '100%', position: 'relative'}}
className={'map'}
zoom={14}
containerStyle={{}}
centerAroundCurrentLocation={true}
onClick={this.onMapClicked}
onDragend={this.onMapMoved} />
)
}
});
export default Container