diff options
-rw-r--r-- | modern/src/GeofencesPage.js | 4 | ||||
-rw-r--r-- | modern/src/reports/ReportLayout.js | 4 | ||||
-rw-r--r-- | modern/src/settings/OptionsLayout/index.js | 5 | ||||
-rw-r--r-- | web/app/view/map/BaseMap.js | 3 | ||||
-rw-r--r-- | web/app/view/map/MapMarkerController.js | 13 |
5 files changed, 15 insertions, 14 deletions
diff --git a/modern/src/GeofencesPage.js b/modern/src/GeofencesPage.js index 71219c1..f441a2f 100644 --- a/modern/src/GeofencesPage.js +++ b/modern/src/GeofencesPage.js @@ -5,6 +5,7 @@ import { import Drawer from '@material-ui/core/Drawer'; import ContainerDimensions from 'react-container-dimensions'; import ArrowBackIcon from '@material-ui/icons/ArrowBack'; +import { useHistory } from 'react-router-dom'; import Map from './map/Map'; import CurrentLocationMap from './map/CurrentLocationMap'; import GeofenceEditMap from './map/GeofenceEditMap'; @@ -49,6 +50,7 @@ const useStyles = makeStyles((theme) => ({ const GeofencesPage = ({ width }) => { const classes = useStyles(); + const history = useHistory(); return ( <div className={classes.root}> @@ -59,7 +61,7 @@ const GeofencesPage = ({ width }) => { classes={{ paper: classes.drawerPaper }} > <div className={classes.drawerHeader}> - <IconButton component="a" href="/"> + <IconButton onClick={() => history.goBack()}> <ArrowBackIcon /> </IconButton> <Typography variant="h6" color="inherit" noWrap> diff --git a/modern/src/reports/ReportLayout.js b/modern/src/reports/ReportLayout.js index c231cd8..69487f2 100644 --- a/modern/src/reports/ReportLayout.js +++ b/modern/src/reports/ReportLayout.js @@ -100,9 +100,7 @@ const ReportLayout = ({ children, filter }) => { classes={{ root: classes.drawerContainer, paper: classes.drawer }} > <div className={classes.drawerHeader}> - <IconButton - onClick={() => history.push('/')} - > + <IconButton onClick={() => history.push('/')}> <ArrowBackIcon /> </IconButton> <Typography variant="h6" color="inherit" noWrap> diff --git a/modern/src/settings/OptionsLayout/index.js b/modern/src/settings/OptionsLayout/index.js index 4a42e58..625148d 100644 --- a/modern/src/settings/OptionsLayout/index.js +++ b/modern/src/settings/OptionsLayout/index.js @@ -1,5 +1,5 @@ import React, { useState, useEffect } from 'react'; -import { useLocation } from 'react-router-dom'; +import { useHistory, useLocation } from 'react-router-dom'; import { Typography, Divider, @@ -53,6 +53,7 @@ const useStyles = makeStyles((theme) => ({ const OptionsLayout = ({ children }) => { const classes = useStyles(); const location = useLocation(); + const history = useHistory(); const [openDrawer, setOpenDrawer] = useState(false); const [optionTitle, setOptionTitle] = useState(); const routes = useRoutes(); @@ -86,7 +87,7 @@ const OptionsLayout = ({ children }) => { classes={{ root: classes.drawerContainer, paper: classes.drawer }} > <div className={classes.drawerHeader}> - <IconButton component="a" href="/"> + <IconButton onClick={() => history.push('/')}> <ArrowBackIcon /> </IconButton> <Typography variant="h6" color="inherit" noWrap> diff --git a/web/app/view/map/BaseMap.js b/web/app/view/map/BaseMap.js index b7c27ce..efd0502 100644 --- a/web/app/view/map/BaseMap.js +++ b/web/app/view/map/BaseMap.js @@ -159,8 +159,6 @@ Ext.define('Traccar.view.map.BaseMap', { })); } - this.body.dom.tabIndex = 0; - switch (Traccar.app.getAttributePreference('distanceUnit', 'km')) { case 'mi': this.map.addControl(new ol.control.ScaleLine({ @@ -183,7 +181,6 @@ Ext.define('Traccar.view.map.BaseMap', { if (typeof target === 'string') { target = Ext.get(target).dom; } - target.focus(); this.map.on('pointermove', function (e) { var hit = this.forEachFeatureAtPixel(e.pixel, function () { diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 15b1aec..2fef487 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -238,7 +238,7 @@ Ext.define('Traccar.view.map.MapMarkerController', { }, animateMarker: function (marker, geometry, course) { - var start, end, duration, timeout, line, updatePosition, self; + var start, end, duration, timeout, line, updatePosition, self, follow; start = marker.getGeometry().getCoordinates(); end = geometry.getCoordinates(); @@ -246,12 +246,16 @@ Ext.define('Traccar.view.map.MapMarkerController', { duration = Traccar.Style.mapAnimateMarkerDuration; timeout = Traccar.Style.mapAnimateMarkerTimeout; self = this; + follow = this.lookupReference('deviceFollowButton').pressed; updatePosition = function (position, marker) { var coordinate, style; coordinate = marker.get('line').getCoordinateAt(position / (duration / timeout)); style = marker.getStyle(); marker.setGeometry(new ol.geom.Point(coordinate)); + if (marker === self.selectedMarker && follow) { + self.getView().getMapView().setCenter(marker.getGeometry().getCoordinates()); + } if (position < duration / timeout) { setTimeout(updatePosition, timeout, position + 1, marker); } else { @@ -344,10 +348,9 @@ Ext.define('Traccar.view.map.MapMarkerController', { if (this.isDeviceVisible(device)) { this.getView().getMarkersSource().addFeature(marker); } - } - - if (marker === this.selectedMarker && this.lookupReference('deviceFollowButton').pressed) { - this.getView().getMapView().setCenter(marker.getGeometry().getCoordinates()); + if (marker === this.selectedMarker && this.lookupReference('deviceFollowButton').pressed) { + this.getView().getMapView().setCenter(marker.getGeometry().getCoordinates()); + } } }, |