From cac80442ee6ce9ed72007733346f17fa410d1674 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 14 Nov 2016 12:15:55 +0500 Subject: Fix icon blinking --- web/app/view/MapController.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index c981fab..c29c490 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -98,7 +98,7 @@ Ext.define('Traccar.view.MapController', { }, updateDevice: function (store, data) { - var i, device, deviceId, marker; + var i, device, deviceId, marker, style; if (!Ext.isArray(data)) { data = [data]; @@ -110,8 +110,12 @@ Ext.define('Traccar.view.MapController', { if (deviceId in this.latestMarkers) { marker = this.latestMarkers[deviceId]; - marker.setStyle( - this.changeMarkerColor(marker.getStyle(), this.getDeviceColor(device), device.get('category'))); + style = marker.getStyle(); + if (style.getImage().fill !== this.getDeviceColor(device) || + style.getImage().category !== device.get('category')) { + marker.setStyle( + this.changeMarkerColor(style, this.getDeviceColor(device), device.get('category'))); + } } } }, @@ -151,8 +155,11 @@ Ext.define('Traccar.view.MapController', { deviceId = position.get('deviceId'); if (deviceId in this.latestMarkers) { marker = this.latestMarkers[deviceId]; + style = marker.getStyle(); + if (style.getImage().angle !== position.get('course')) { + marker.setStyle(this.rotateMarker(marker.getStyle(), position.get('course'))); + } marker.setGeometry(geometry); - marker.setStyle(this.rotateMarker(marker.getStyle(), position.get('course'))); } else { marker = new ol.Feature(geometry); marker.set('record', device); -- cgit v1.2.3