From 4fde7ab37d8c81fec207adb5f2e967ce43521371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 16 Jun 2015 17:52:34 +0200 Subject: [PATCH] Add applyMatrix option to importSVG() --- examples/SVG Import/Arcs.html | 4 +++- src/item/Item.js | 3 +++ src/project/Project.js | 4 ++-- src/svg/SVGImport.js | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/SVG Import/Arcs.html b/examples/SVG Import/Arcs.html index a1bf4a51..6a2412a9 100644 --- a/examples/SVG Import/Arcs.html +++ b/examples/SVG Import/Arcs.html @@ -5,7 +5,9 @@ Arcs Testing diff --git a/src/item/Item.js b/src/item/Item.js index ad102335..7dc04042 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -2101,6 +2101,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ * * @option [options.expandShapes=false] {Boolean} whether imported shape * items should be expanded to path items + * @option [options.applyMatrix={@link PaperScope#settings}.applyMatrix] + * {Boolean} whether imported items should have their transformation + * matrices applied to their contents or not * * @param {SVGElement|String} svg the SVG content to import * @param {Object} [options] the import options diff --git a/src/project/Project.js b/src/project/Project.js index beb02465..38b852ee 100644 --- a/src/project/Project.js +++ b/src/project/Project.js @@ -661,8 +661,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{ * @option [options.expandShapes=false] {Boolean} whether imported shape * items should be expanded to path items * @option [options.applyMatrix={@link PaperScope#settings}.applyMatrix] - * {Boolean} whether imported items should have - * their transformation matrices applied to their contents or not + * {Boolean} whether imported items should have their transformation + * matrices applied to their contents or not * * @param {SVGElement|String} svg the SVG content to import * @param {Object} [options] the import options diff --git a/src/svg/SVGImport.js b/src/svg/SVGImport.js index 4b50ef65..74e9dbac 100644 --- a/src/svg/SVGImport.js +++ b/src/svg/SVGImport.js @@ -628,7 +628,7 @@ new function() { definitions = {}; // Now if settings.applyMatrix was set, apply recursively and set // #applyMatrix = true on the item and all children. - if (applyMatrix && item) + if (item && Base.pick(options.applyMatrix, applyMatrix)) item.matrix.apply(true, true); } return item;