aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-26 11:35:06 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-26 11:35:06 +1200
commitbd7a6ae5a724b6c23cb7f339c1ef7977662a779b (patch)
treefe0b748147d7fe814eae5a8f174e685d20394805 /web/app
parentca542b3d628ff3fcbc9e26fb2338029a55559e76 (diff)
downloadtraccar-server-bd7a6ae5a724b6c23cb7f339c1ef7977662a779b.tar.gz
traccar-server-bd7a6ae5a724b6c23cb7f339c1ef7977662a779b.tar.bz2
traccar-server-bd7a6ae5a724b6c23cb7f339c1ef7977662a779b.zip
Set default map position
Diffstat (limited to 'web/app')
-rw-r--r--web/app/Resources.js6
-rw-r--r--web/app/view/map/Map.js13
2 files changed, 14 insertions, 5 deletions
diff --git a/web/app/Resources.js b/web/app/Resources.js
index 446c59594..65c1e485f 100644
--- a/web/app/Resources.js
+++ b/web/app/Resources.js
@@ -26,8 +26,10 @@ var styles = {
report_time: 100,
report_format: 'Y-m-d H:i:s',
- map_center: [ -0.1275, 51.507222 ],
- map_zoom: 6,
+ map_default_lat: -0.1275,
+ map_default_lon: 51.507222,
+ map_default_zoom: 6,
+
map_max_zoom: 16,
map_select_color: 'rgba(0, 255, 0, 1.0)',
map_select_radius: 10,
diff --git a/web/app/view/map/Map.js b/web/app/view/map/Map.js
index b4fa8338f..57ecebe7d 100644
--- a/web/app/view/map/Map.js
+++ b/web/app/view/map/Map.js
@@ -30,8 +30,11 @@ Ext.define('Traccar.view.map.Map', {
listeners: {
afterrender: function() {
+ var user = Traccar.getApplication().getUser();
+ var server = Traccar.getApplication().getServer();
+
var layer;
- var mapLayer = Traccar.getApplication().getUser().get('map') || Traccar.getApplication().getServer().get('map');
+ var mapLayer = user.get('map') || server.get('map');
var bindKey = 'AseEs0DLJhLlTNoxbNXu7DGsnnH4UoWuGue7-irwKkE3fffaClwc9q_Mr6AyHY8F';
@@ -55,9 +58,13 @@ Ext.define('Traccar.view.map.Map', {
source: this.vectorSource
});
+ var lat = user.get('latitude') || server.get('latitude') || styles.map_default_lat;
+ var lon = user.get('longitude') || server.get('longitude') || styles.map_default_lon;
+ var zoom = user.get('zoom') || server.get('zoom') || styles.map_default_zoom;
+
this.mapView = new ol.View({
- center: ol.proj.fromLonLat(styles.map_center),
- zoom: styles.map_zoom,
+ center: ol.proj.fromLonLat([lat, lon]),
+ zoom: zoom,
maxZoom: styles.map_max_zoom
});