From deea5b703fd83e699d62600d93b3e28ac71188a1 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 27 Jun 2015 10:39:47 +1200 Subject: Fix few minor UI issues --- web/app/view/map/MapController.js | 24 ++++++++++++------------ web/app/view/state/StateController.js | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/web/app/view/map/MapController.js b/web/app/view/map/MapController.js index f830593e3..27a42a2ce 100644 --- a/web/app/view/map/MapController.js +++ b/web/app/view/map/MapController.js @@ -170,6 +170,7 @@ Ext.define('Traccar.view.map.MapController', { if (this.reportRoute !== undefined) { vectorSource.removeFeature(this.reportRoute); + this.reportRoute = undefined; } if (this.reportRoutePoints !== undefined) { @@ -178,9 +179,8 @@ Ext.define('Traccar.view.map.MapController', { vectorSource.removeFeature(this.reportRoutePoints[key]); } } + this.reportRoutePoints = {}; } - - this.reportRoutePoints = {}; }, selectPosition: function(feature) { @@ -188,22 +188,22 @@ Ext.define('Traccar.view.map.MapController', { this.currentFeature.setStyle(this.currentFeature.get('originalStyle')); } - feature.setStyle(this.getMarkerStyle(styles.map_select_radius, styles.map_select_color)); + if (feature !== undefined) { + feature.setStyle(this.getMarkerStyle(styles.map_select_radius, styles.map_select_color)); - var pan = ol.animation.pan({ - duration: styles.map_delay, - source: this.getView().mapView.getCenter() - }); - this.getView().map.beforeRender(pan); - this.getView().mapView.setCenter(feature.getGeometry().getCoordinates()); + var pan = ol.animation.pan({ + duration: styles.map_delay, + source: this.getView().mapView.getCenter() + }); + this.getView().map.beforeRender(pan); + this.getView().mapView.setCenter(feature.getGeometry().getCoordinates()); + } this.currentFeature = feature; }, selectDevice: function(device) { - if (this.liveData[device.get('id')] !== undefined) { - this.selectPosition(this.liveData[device.get('id')]); - } + this.selectPosition(this.liveData[device.get('id')]); }, selectReport: function(position) { diff --git a/web/app/view/state/StateController.js b/web/app/view/state/StateController.js index b6a6cc542..f87a89664 100644 --- a/web/app/view/state/StateController.js +++ b/web/app/view/state/StateController.js @@ -72,7 +72,6 @@ Ext.define('Traccar.view.state.StateController', { updatePosition: function(position) { var store = Ext.getStore('Parameters'); - store.removeAll(); for (var key in position.data) { if (position.data.hasOwnProperty(key) && this.keys[key] !== undefined) { @@ -102,6 +101,7 @@ Ext.define('Traccar.view.state.StateController', { selectDevice: function(device) { this.deviceId = device.get('id'); var found = Ext.getStore('LiveData').query('deviceId', this.deviceId); + Ext.getStore('Parameters').removeAll(); if (found.getCount() > 0) { this.updatePosition(found.first()); } -- cgit v1.2.3