aboutsummaryrefslogtreecommitdiff
path: root/web/app/DeviceImages.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/DeviceImages.js')
-rw-r--r--web/app/DeviceImages.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js
index d976a2b3..a05a8153 100644
--- a/web/app/DeviceImages.js
+++ b/web/app/DeviceImages.js
@@ -24,6 +24,9 @@ Ext.define('Traccar.DeviceImages', {
info = Ext.getStore('DeviceImages').findRecord('key', category || 'default', 0, false, false, true);
svg = Ext.clone(info.get('svg'));
+ if (!svg) {
+ svg = this.cloneDocument(info.get('svg'));
+ }
width = parseFloat(svg.documentElement.getAttribute('width'));
height = parseFloat(svg.documentElement.getAttribute('height'));
@@ -67,6 +70,14 @@ Ext.define('Traccar.DeviceImages', {
encodeURIComponent(new XMLSerializer().serializeToString(svg.documentElement));
},
+ cloneDocument: function (svgDocument) {
+ var newDocument, newNode;
+ newDocument = svgDocument.implementation.createDocument(svgDocument.namespaceURI, null, null);
+ newNode = newDocument.importNode(svgDocument.documentElement, true);
+ newDocument.appendChild(newNode);
+ return newDocument;
+ },
+
getImageIcon: function (color, zoom, angle, category) {
var image, svg, width, height;