diff --git a/src/svg/SvgImport.js b/src/svg/SvgImport.js index 539283bf..87ba37d0 100644 --- a/src/svg/SvgImport.js +++ b/src/svg/SvgImport.js @@ -222,9 +222,8 @@ new function() { // half of its size. We also need to take the raster's matrix // into account, which will be defined by the time the load // event is called. - var center = this._matrix._transformPoint( - getPoint(node).add(size.divide(2))); - this.translate(center); + var center = getPoint(node).add(size.divide(2)); + this._matrix.append(new Matrix(1, 0, 0, 1, center.x, center.y)); }); return raster; }, diff --git a/test/tests/SvgImport.js b/test/tests/SvgImport.js index e71b00ab..474d8043 100644 --- a/test/tests/SvgImport.js +++ b/test/tests/SvgImport.js @@ -114,6 +114,18 @@ test('Import SVG polyline', function() { equals(imported, path); }); +test('Import SVG Image', function(assert) { + var done = assert.async(); + var points = '5,5 45,45 5,45 45,5'; + var svg = ''; + var imported = paper.project.importSVG(svg); + var raster = imported.children[0]; + raster.on('load', function() { + equals(raster.matrix, new Matrix(0.2149, 0, 0, 0.2149, 337.0056, 205.01675)); + done(); + }); +}); + test('Import complex CompoundPath and clone', function() { var svg = ''; var item = paper.project.importSVG(svg);