From 020a2409a58e73e988a108e314006f45b436b572 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Sat, 26 Nov 2016 14:21:48 +0700 Subject: Totally update device marker instead of updating only image src --- web/app/view/MapController.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'web/app/view/MapController.js') diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index 9fcd493..bea1253 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -103,9 +103,7 @@ Ext.define('Traccar.view.MapController', { style = marker.getStyle(); if (style.getImage().fill !== this.getDeviceColor(device) || style.getImage().category !== device.get('category')) { - Traccar.DeviceImages.changeImageColor(style.getImage(), - this.getDeviceColor(device), device.get('category')); - marker.changed(); + marker.setStyle(this.updateDeviceMarker(style, this.getDeviceColor(device), device.get('category'))); } if (style.getText().getText() !== device.get('name')) { style.getText().setText(device.get('name')); @@ -339,6 +337,20 @@ Ext.define('Traccar.view.MapController', { }); }, + updateDeviceMarker: function (style, color, category) { + var image, text; + image = Traccar.DeviceImages.getImageIcon(color, + style.getImage().zoom, + style.getImage().angle, + category); + text = style.getText(); + text.setOffsetY(-image.getSize()[1] / 2 - Traccar.Style.mapTextOffset); + return new ol.style.Style({ + image: image, + text: text + }); + }, + selectMarker: function (marker, center) { if (this.selectedMarker) { this.selectedMarker.setStyle( -- cgit v1.2.3