aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-21 12:21:03 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-21 12:21:03 +1300
commit4550377ff48566c444ee96678b9da8107e21ef55 (patch)
tree5991fe0dbae1b898f287e1233a054197f7fbd454 /web/app
parentca02696ce4ebe43652ec97b28c6553bd97910dcd (diff)
downloadtraccar-server-4550377ff48566c444ee96678b9da8107e21ef55.tar.gz
traccar-server-4550377ff48566c444ee96678b9da8107e21ef55.tar.bz2
traccar-server-4550377ff48566c444ee96678b9da8107e21ef55.zip
Implement automatic device following
Diffstat (limited to 'web/app')
-rw-r--r--web/app/view/Devices.js6
-rw-r--r--web/app/view/MapController.js8
2 files changed, 14 insertions, 0 deletions
diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js
index 128cd3be1..21bea6980 100644
--- a/web/app/view/Devices.js
+++ b/web/app/view/Devices.js
@@ -42,6 +42,12 @@ Ext.define('Traccar.view.Devices', {
}, {
xtype: 'tbfill'
}, {
+ id:'deviceFollowButton',
+ glyph: 'xf05b@FontAwesome',
+ tooltip: Strings.deviceFollow,
+ tooltipType: 'title',
+ enableToggle: true
+ }, {
xtype: 'settingsMenu'
}]
},
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index a3412b796..e4ce53b57 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -97,6 +97,10 @@ Ext.define('Traccar.view.MapController', {
}
},
+ followSelected: function () {
+ return Ext.getCmp('deviceFollowButton') && Ext.getCmp('deviceFollowButton').pressed;
+ },
+
updateLatest: function (store, data) {
var i, position, geometry, device, deviceId, marker, style;
@@ -129,6 +133,10 @@ Ext.define('Traccar.view.MapController', {
}
marker.getStyle().getImage().setRotation(position.get('course') * Math.PI / 180);
+
+ if (marker === this.selectedMarker && this.followSelected()) {
+ this.getView().getMapView().setCenter(marker.getGeometry().getCoordinates());
+ }
}
},