Skip to content

Commit e13e205

Browse files
chqy24gondzo
authored andcommitted
f2f challenge 30056068
1 parent a21fee5 commit e13e205

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

src/components/MapHistory/MapHistory.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
});

src/routes/DronesMap/components/DronesMapView.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, {PropTypes} from 'react';
2+
import _ from 'lodash';
23
import CSSModules from 'react-css-modules';
34
import MarkerClusterer from 'node-js-marker-clusterer';
45
import MapHistory from 'components/MapHistory';
56
import Info from './Info';
67
import styles from './DronesMapView.scss';
7-
const _ = require('lodash');
88

99
const 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) {

src/routes/DronesMap/modules/DronesMap.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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
});

src/routes/MissionPlanner/components/MissionMap/MissionMap.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy