diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/DeviceImages.js | 10 | ||||
-rw-r--r-- | web/app/store/DeviceImages.js | 18 | ||||
-rw-r--r-- | web/app/view/MapController.js | 2 |
3 files changed, 22 insertions, 8 deletions
diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js index c79406b0..d781b529 100644 --- a/web/app/DeviceImages.js +++ b/web/app/DeviceImages.js @@ -20,7 +20,7 @@ Ext.define('Traccar.DeviceImages', { singleton: true, getImageIcon: function(color, zoom, angle, category) { - var image, device, svg, width, height, rotateTransform, scaleTransform, transform; + var image, device, svg, width, height, rotateTransform, scaleTransform, transform, fill; // Get right image or fallback to default arrow if (category) { device = Ext.getStore('DeviceImages').findRecord('key', category); @@ -36,7 +36,13 @@ Ext.define('Traccar.DeviceImages', { width = parseFloat(svg.documentElement.getAttribute('width')); height = parseFloat(svg.documentElement.getAttribute('height')); // Colorize - svg.getElementById(device.get('fillId')).style.fill = color; + fill = device.get('fillId'); + if (!Ext.isArray(fill)) { + fill = [fill]; + } + for (i = 0; i < fill.length; i++) { + svg.getElementById(fill[i]).style.fill = color; + } // Prepare rotate transformation rotateTransform = 'rotate(' + angle + ' ' + (width / 2) + ' ' + (height / 2) + ')'; svg.getElementById(device.get('rotateId')).setAttribute('transform', rotateTransform); diff --git a/web/app/store/DeviceImages.js b/web/app/store/DeviceImages.js index e7ad4cbc..ba91575a 100644 --- a/web/app/store/DeviceImages.js +++ b/web/app/store/DeviceImages.js @@ -20,18 +20,26 @@ Ext.define('Traccar.store.DeviceImages', { fields: ['key', 'name', 'svg', 'fillId', 'rotateId', 'scaleId', 'scale'], data: [{ - key: 'default', + key: 'route', name: Strings.categoryDefault, - svg: document.getElementById('arrowSvg').contentDocument, + svg: document.getElementById('routeSvg').contentDocument, fillId: 'arrow', rotateId: 'arrow', scaleId: 'arrow', scale: 1 }, { + key: 'default', + name: Strings.categoryDefault, + svg: document.getElementById('defaultSvg').contentDocument, + fillId: ['arrow', 'path4148'], + rotateId: 'layer2', + scaleId: 'layer2', + scale: 1 + }, { key: 'car', name: Strings.categoryCar, svg: document.getElementById('carSvg').contentDocument, - fillId: 'path4148', + fillId: ['path4148', 'path4157'], rotateId: 'path4148', scaleId: 'layer2', scale: 1 @@ -39,7 +47,7 @@ Ext.define('Traccar.store.DeviceImages', { key: 'bus', name: Strings.categoryBus, svg: document.getElementById('busSvg').contentDocument, - fillId: 'path4148', + fillId: ['path4148', 'path4200'], rotateId: 'path4148', scaleId: 'layer2', scale: 1 @@ -47,7 +55,7 @@ Ext.define('Traccar.store.DeviceImages', { key: 'truck', name: Strings.categoryTruck, svg: document.getElementById('truckSvg').contentDocument, - fillId: 'path4148', + fillId: ['path4148', 'path4336'], rotateId: 'path4148', scaleId: 'layer2', scale: 1 diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js index 2f72e81c..a0e28671 100644 --- a/web/app/view/MapController.js +++ b/web/app/view/MapController.js @@ -305,7 +305,7 @@ Ext.define('Traccar.view.MapController', { if (deviceId !== undefined) { index = deviceId % Traccar.Style.mapRouteColor.length; } - return this.getMarkerStyle(false, Traccar.Style.mapRouteColor[index], angle); + return this.getMarkerStyle(false, Traccar.Style.mapRouteColor[index], angle, 'route'); }, resizeMarker: function (style, zoom) { |