aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
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/view
parentca542b3d628ff3fcbc9e26fb2338029a55559e76 (diff)
downloadtrackermap-server-bd7a6ae5a724b6c23cb7f339c1ef7977662a779b.tar.gz
trackermap-server-bd7a6ae5a724b6c23cb7f339c1ef7977662a779b.tar.bz2
trackermap-server-bd7a6ae5a724b6c23cb7f339c1ef7977662a779b.zip
Set default map position
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/map/Map.js13
1 files changed, 10 insertions, 3 deletions
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
});