diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-11-14 22:38:09 +1300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-14 22:38:09 +1300 |
commit | 80d9fbb49758db4bab8b3750894a945c0af7fd7f (patch) | |
tree | af519260ef33e76224cc1466ea7bee2c9cd06a93 | |
parent | f31ff81c2b027e2b0ecfe0cba33b6a74c58ab228 (diff) | |
parent | cac80442ee6ce9ed72007733346f17fa410d1674 (diff) | |
download | trackermap-web-80d9fbb49758db4bab8b3750894a945c0af7fd7f.tar.gz trackermap-web-80d9fbb49758db4bab8b3750894a945c0af7fd7f.tar.bz2 trackermap-web-80d9fbb49758db4bab8b3750894a945c0af7fd7f.zip |
Merge pull request #315 from Abyss777/fix_icon_blinking
Fix icon blinking
-rw-r--r-- | web/app/DeviceImages.js | 1 | ||||
-rw-r--r-- | web/app/view/MapController.js | 15 |
2 files changed, 12 insertions, 4 deletions
diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js index 1e63cf29..96f00980 100644 --- a/web/app/DeviceImages.js +++ b/web/app/DeviceImages.js @@ -73,6 +73,7 @@ Ext.define('Traccar.DeviceImages', { imgSize: [width, height], src: 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(new XMLSerializer().serializeToString(svg.documentElement)) }); + image.load(); image.fill = color; image.zoom = zoom; image.angle = angle; diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index c981fabc..c29c4900 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); |