diff --git a/src/octoprint/plugins/svgtogcode/static/js/matrix_oven.js b/src/octoprint/plugins/svgtogcode/static/js/matrix_oven.js index dce7235a..478c638e 100644 --- a/src/octoprint/plugins/svgtogcode/static/js/matrix_oven.js +++ b/src/octoprint/plugins/svgtogcode/static/js/matrix_oven.js @@ -70,12 +70,14 @@ Snap.plugin(function (Snap, Element, Paper, global) { // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement: // If 'x' and 'y' are not specified, then set both to 0. // CorelDraw is creating that sometimes - if (!isFinite(x)) + if (!isFinite(x)) { console.log('No attribute "x" in image tag. Assuming 0.') x = 0; - if (!isFinite(y)) + } + if (!isFinite(y)) { console.log('No attribute "y" in image tag. Assuming 0.') y = 0; + } var transform = elem.transform(); var matrix = transform['totalMatrix']; var transformedX = matrix.x(x, y); diff --git a/src/octoprint/plugins/svgtogcode/static/js/working_area.js b/src/octoprint/plugins/svgtogcode/static/js/working_area.js index da0441e1..b5bb2bd7 100644 --- a/src/octoprint/plugins/svgtogcode/static/js/working_area.js +++ b/src/octoprint/plugins/svgtogcode/static/js/working_area.js @@ -347,7 +347,7 @@ $(function(){ dx = -svgBB.x + 0.01; outside = true; } else if(svgBB.x2 > waBB.x2){ - dx = -svgBB.x2 + waBB.x2 - 0.01; + dx = -svgBB.x + 0.01; outside = true; } if(svgBB.y < waBB.y){ @@ -760,7 +760,12 @@ $(function(){ self._embedAllImages = function(svg, callback){ var allImages = svg.selectAll('image'); - var linkedImages = allImages.items.filter(function(i){ return !i.attr('href').startsWith('data:') }); + var linkedImages = allImages.items.filter(function(i){ + if(i.attr('xlink:href') != null) { + return !i.attr('xlink:href').startsWith('data:'); + } else if(i.attr('href') != null) { + return !i.attr('href').startsWith('data:'); + }}); if(linkedImages.length > 0){ var callbackCounter = linkedImages.length; for (var i = 0; i < linkedImages.length; i++) {