mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
Add applyMatrix option to importSVG()
This commit is contained in:
parent
036ba45326
commit
4fde7ab37d
4 changed files with 9 additions and 4 deletions
|
@ -5,7 +5,9 @@
|
|||
<title>Arcs Testing</title>
|
||||
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
||||
<script type="text/paperscript" canvas="canvas">
|
||||
project.importSVG(document.getElementById('svg'));
|
||||
project.importSVG(document.getElementById('svg'), {
|
||||
applyMatrix: false
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue