1
- import React , { PropTypes } from 'react' ;
1
+ import React , { PropTypes } from 'react' ;
2
2
import CSSModules from 'react-css-modules' ;
3
3
import MarkerClusterer from 'node-js-marker-clusterer' ;
4
4
import MapHistory from 'components/MapHistory' ;
@@ -20,7 +20,7 @@ const getIcon = (status) => {
20
20
21
21
const HIDE_INFO_DELAY = 500 ;
22
22
23
- const getLatLng = ( { currentLocation } ) => ( { lng : currentLocation [ 0 ] , lat : currentLocation [ 1 ] } ) ;
23
+ const getLatLng = ( { currentLocation} ) => ( { lng : currentLocation [ 0 ] , lat : currentLocation [ 1 ] } ) ;
24
24
25
25
const getMarkerPoint = ( marker , overlay ) => ( overlay . getProjection ( ) . fromLatLngToContainerPixel ( marker . getPosition ( ) ) ) ;
26
26
@@ -35,12 +35,14 @@ class DronesMapView extends React.Component {
35
35
}
36
36
37
37
componentDidMount ( ) {
38
- const { drones, mapSettings, showInfo, hideInfo } = this . props ;
38
+ const { drones, mapSettings, showInfo, hideInfo} = this . props ;
39
39
this . map = new google . maps . Map ( this . node , mapSettings ) ;
40
40
const overlay = new google . maps . OverlayView ( ) ;
41
41
overlay . draw = ( ) => { } ;
42
42
overlay . setMap ( this . map ) ;
43
- const hideInfoWindow = ( ) => { this . props . infoDrone && hideInfo ( ) ; } ;
43
+ const hideInfoWindow = ( ) => {
44
+ this . props . infoDrone && hideInfo ( ) ;
45
+ } ;
44
46
this . map . addListener ( 'zoom_changed' , hideInfoWindow ) ;
45
47
this . map . addListener ( 'dragstart' , hideInfoWindow ) ;
46
48
const id2Marker = { } ;
@@ -73,11 +75,11 @@ class DronesMapView extends React.Component {
73
75
return marker ;
74
76
} ) ;
75
77
this . id2Marker = id2Marker ;
76
- this . markerCluster = new MarkerClusterer ( this . map , markers , { imagePath : '/img/m' } ) ;
78
+ this . markerCluster = new MarkerClusterer ( this . map , markers , { imagePath : '/img/m' } ) ;
77
79
}
78
80
79
81
componentWillReceiveProps ( nextProps ) {
80
- const { drones } = nextProps ;
82
+ const { drones} = nextProps ;
81
83
drones . forEach ( ( drone ) => {
82
84
const marker = this . id2Marker [ drone . id ] ;
83
85
if ( marker ) {
@@ -114,7 +116,7 @@ class DronesMapView extends React.Component {
114
116
< div styleName = "map-view" ref = { ( node ) => ( this . node = node ) } />
115
117
{
116
118
this . props . infoDrone ?
117
- ( < div styleName = "map-popover" onMouseEnter = { this . cancelHideInfo } onMouseLeave = { this . props . hideInfo } style = { { top : this . props . infoPos . y - 30 , left : this . props . infoPos . x } } >
119
+ ( < div styleName = "map-popover" onMouseEnter = { this . cancelHideInfo } onMouseLeave = { this . props . hideInfo } style = { { top : this . props . infoPos . y - 30 , left : this . props . infoPos . x } } >
118
120
< Info drone = { this . props . infoDrone } showHistory = { this . showHistory } />
119
121
</ div > ) : null
120
122
}
0 commit comments