diff options
-rw-r--r-- | web/app/DeviceImages.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/web/app/DeviceImages.js b/web/app/DeviceImages.js index d976a2b3..502d412e 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 (document) { + var newDocument, newNode; + newDocument = document.implementation.createDocument(document.namespaceURI, null, null); + newNode = newDocument.importNode(document.documentElement, true); + newDocument.appendChild(newNode); + return newDocument; + }, + getImageIcon: function (color, zoom, angle, category) { var image, svg, width, height; |