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>
|
<title>Arcs Testing</title>
|
||||||
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
<script type="text/javascript" src="../../dist/paper-full.js"></script>
|
||||||
<script type="text/paperscript" canvas="canvas">
|
<script type="text/paperscript" canvas="canvas">
|
||||||
project.importSVG(document.getElementById('svg'));
|
project.importSVG(document.getElementById('svg'), {
|
||||||
|
applyMatrix: false
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -2101,6 +2101,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
*
|
*
|
||||||
* @option [options.expandShapes=false] {Boolean} whether imported shape
|
* @option [options.expandShapes=false] {Boolean} whether imported shape
|
||||||
* items should be expanded to path items
|
* 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 {SVGElement|String} svg the SVG content to import
|
||||||
* @param {Object} [options] the import options
|
* @param {Object} [options] the import options
|
||||||
|
|
|
@ -661,8 +661,8 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
|
||||||
* @option [options.expandShapes=false] {Boolean} whether imported shape
|
* @option [options.expandShapes=false] {Boolean} whether imported shape
|
||||||
* items should be expanded to path items
|
* items should be expanded to path items
|
||||||
* @option [options.applyMatrix={@link PaperScope#settings}.applyMatrix]
|
* @option [options.applyMatrix={@link PaperScope#settings}.applyMatrix]
|
||||||
* {Boolean} whether imported items should have
|
* {Boolean} whether imported items should have their transformation
|
||||||
* their transformation matrices applied to their contents or not
|
* matrices applied to their contents or not
|
||||||
*
|
*
|
||||||
* @param {SVGElement|String} svg the SVG content to import
|
* @param {SVGElement|String} svg the SVG content to import
|
||||||
* @param {Object} [options] the import options
|
* @param {Object} [options] the import options
|
||||||
|
|
|
@ -628,7 +628,7 @@ new function() {
|
||||||
definitions = {};
|
definitions = {};
|
||||||
// Now if settings.applyMatrix was set, apply recursively and set
|
// Now if settings.applyMatrix was set, apply recursively and set
|
||||||
// #applyMatrix = true on the item and all children.
|
// #applyMatrix = true on the item and all children.
|
||||||
if (applyMatrix && item)
|
if (item && Base.pick(options.applyMatrix, applyMatrix))
|
||||||
item.matrix.apply(true, true);
|
item.matrix.apply(true, true);
|
||||||
}
|
}
|
||||||
return item;
|
return item;
|
||||||
|
|
Loading…
Reference in a new issue