From bd7a6ae5a724b6c23cb7f339c1ef7977662a779b Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 26 Jul 2015 11:35:06 +1200 Subject: Set default map position --- web/app/view/map/Map.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'web/app/view/map/Map.js') 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 }); -- cgit v1.2.3