File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed
MissionPlanner/components/MissionMap Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ class MapHistory extends React.Component {
191191
192192 // show info window when mouse hover
193193 marker . addListener ( 'mouseover' , ( ) => {
194- this . infoWindow . setContent ( new moment ( l . createdAt ) . format ( DATE_FORMAT ) ) ;
194+ this . infoWindow . setContent ( new moment ( l . createdAt ) . format ( DATE_FORMAT ) ) ; // eslint-disable-line new-cap
195195 this . infoWindow . setPosition ( marker . getPosition ( ) ) ;
196196 this . infoWindow . open ( this . map ) ;
197197 } ) ;
Original file line number Diff line number Diff line change 11import React , { PropTypes } from 'react' ;
2+ import _ from 'lodash' ;
23import CSSModules from 'react-css-modules' ;
34import MarkerClusterer from 'node-js-marker-clusterer' ;
45import MapHistory from 'components/MapHistory' ;
56import Info from './Info' ;
67import styles from './DronesMapView.scss' ;
7- const _ = require ( 'lodash' ) ;
88
99const getIcon = ( status ) => {
1010 switch ( status ) {
@@ -77,6 +77,16 @@ class DronesMapView extends React.Component {
7777 } ) ;
7878 this . id2Marker = id2Marker ;
7979 this . markerCluster = new MarkerClusterer ( this . map , markers , { imagePath : '/img/m' } ) ;
80+
81+ navigator . geolocation . getCurrentPosition ( ( pos ) => {
82+ this . map . setCenter ( {
83+ lat : pos . coords . latitude ,
84+ lng : pos . coords . longitude ,
85+ } ) ;
86+ } ,
87+ null ,
88+ { timeout : 60000 }
89+ ) ;
8090 }
8191
8292 componentWillReceiveProps ( nextProps ) {
Original file line number Diff line number Diff line change @@ -128,6 +128,9 @@ export default handleActions({
128128 // it will show the whole globe
129129 mapSettings : {
130130 zoom : 3 ,
131- center : { lat : 0 , lng : 0 } ,
131+ center : {
132+ lat : 0 ,
133+ lng : 0 ,
134+ } ,
132135 } ,
133136} ) ;
Original file line number Diff line number Diff line change @@ -81,7 +81,16 @@ export class MissionMap extends Component {
8181
8282 handleMapLoad ( map ) {
8383 if ( map ) {
84- this . fitMapToBounds ( map , this . props . markers ) ;
84+ // this.fitMapToBounds(map, this.props.markers);
85+ navigator . geolocation . getCurrentPosition ( ( pos ) => {
86+ map . panTo ( {
87+ lat : pos . coords . latitude ,
88+ lng : pos . coords . longitude ,
89+ } ) ;
90+ } ,
91+ null ,
92+ { timeout : 60000 }
93+ ) ;
8594 }
8695 }
8796
You can’t perform that action at this time.
0 commit comments