diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-18 19:12:49 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-18 19:12:49 +1300 |
commit | 30f97a3af0dab8724f6c4c3c32da25f1adbf4221 (patch) | |
tree | 93e37644f5d758cf17025bd1a3be85c2561e21b0 /web/app/view/Map.js | |
parent | 94bbf51bdf1a303dfcb9a04f1629e9cee1567fce (diff) | |
download | trackermap-server-30f97a3af0dab8724f6c4c3c32da25f1adbf4221.tar.gz trackermap-server-30f97a3af0dab8724f6c4c3c32da25f1adbf4221.tar.bz2 trackermap-server-30f97a3af0dab8724f6c4c3c32da25f1adbf4221.zip |
Clean up map and state code
Diffstat (limited to 'web/app/view/Map.js')
-rw-r--r-- | web/app/view/Map.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/web/app/view/Map.js b/web/app/view/Map.js index 709684e29..9a032e79f 100644 --- a/web/app/view/Map.js +++ b/web/app/view/Map.js @@ -29,28 +29,28 @@ Ext.define('Traccar.view.Map', { listeners: { afterrender: function () { - var user = Traccar.app.getUser(); - var server = Traccar.app.getServer(); + var user, server, layer, type, bingKey, vectorLayer, lat, lon, zoom; - var layer; - var mapLayer = user.get('map') || server.get('map'); + user = Traccar.app.getUser(); + server = Traccar.app.getServer(); - var bingKey = server.get('bingKey'); + type = user.get('map') || server.get('map'); + bingKey = server.get('bingKey'); - if (mapLayer === 'custom') { + if (type === 'custom') { layer = new ol.layer.Tile({ source: new ol.source.XYZ({ url: server.get('mapUrl') }) }); - } else if (mapLayer === 'bingRoad') { + } else if (type === 'bingRoad') { layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ key: bingKey, imagerySet: 'Road' }) }); - } else if (mapLayer === 'bingAerial') { + } else if (type === 'bingAerial') { layer = new ol.layer.Tile({ source: new ol.source.BingMaps({ key: bingKey, @@ -64,13 +64,13 @@ Ext.define('Traccar.view.Map', { } this.vectorSource = new ol.source.Vector({}); - var vectorLayer = new ol.layer.Vector({ + vectorLayer = new ol.layer.Vector({ source: this.vectorSource }); - var lat = user.get('latitude') || server.get('latitude') || Traccar.Style.mapDefaultLat; - var lon = user.get('longitude') || server.get('longitude') || Traccar.Style.mapDefaultLon; - var zoom = user.get('zoom') || server.get('zoom') || Traccar.Style.mapDefaultZoom; + lat = user.get('latitude') || server.get('latitude') || Traccar.Style.mapDefaultLat; + lon = user.get('longitude') || server.get('longitude') || Traccar.Style.mapDefaultLon; + zoom = user.get('zoom') || server.get('zoom') || Traccar.Style.mapDefaultZoom; this.mapView = new ol.View({ center: ol.proj.fromLonLat([lon, lat]), |