Include documentation about importSVG() onLoad callbacks.

See #715.
This commit is contained in:
Jürg Lehni 2015-06-23 09:40:11 +02:00
parent 19bcd19b49
commit 708e8d7834
2 changed files with 46 additions and 6 deletions

View file

@ -2089,7 +2089,6 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
* @return {SVGElement} the item converted to an SVG node
*/
// DOCS: Document importSVG('file.svg', callback);
/**
* Converts the provided SVG content into Paper.js items and adds them to
* the this item's children list.
@ -2101,13 +2100,34 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
*
* @option [options.expandShapes=false] {Boolean} whether imported shape
* items should be expanded to path items
* @option [options.onLoad] {Function} the callback function to call once
* the SVG content is loaded from the given URL. Only required when loading
* from external files.
* @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, either as a SVG
* DOM node, a string containing SVG content, or a string describing the URL
* of the SVG file to fetch.
* @param {Object} [options] the import options
* @return {Item} the imported Paper.js parent item
* @return {Item} the newly created Paper.js item containing the converted
* SVG content
*/
/**
* Imports the provided external SVG file, converts it into Paper.js items
* and adds them to the this item's children list.
* Note that the item is not cleared first. You can call
* {@link Item#removeChildren()} to do so.
*
* @name Item#importSVG
* @function
*
* @param {SVGElement|String} svg the URL of the SVG file to fetch.
* @param {Function} onLoad the callback function to call once the SVG
* content is loaded from the given URL.
* @return {Item} the newly created Paper.js item containing the converted
* SVG content
*/
/**

View file

@ -648,7 +648,6 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
* @return {SVGElement} the project converted to an SVG node
*/
// DOCS: Document importSVG('file.svg', callback);
/**
* Converts the provided SVG content into Paper.js items and adds them to
* the active layer of this project.
@ -660,13 +659,34 @@ var Project = PaperScopeItem.extend(/** @lends Project# */{
*
* @option [options.expandShapes=false] {Boolean} whether imported shape
* items should be expanded to path items
* @option [options.onLoad] {Function} the callback function to call once
* the SVG content is loaded from the given URL. Only required when loading
* from external files.
* @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, either as a SVG
* DOM node, a string containing SVG content, or a string describing the URL
* of the SVG file to fetch.
* @param {Object} [options] the import options
* @return {Item} the imported Paper.js parent item
* @return {Item} the newly created Paper.js item containing the converted
* SVG content
*/
/**
* Imports the provided external SVG file, converts it into Paper.js items
* and adds them to the active layer of this project.
* Note that the project is not cleared first. You can call
* {@link Project#clear()} to do so.
*
* @name Project#importSVG
* @function
*
* @param {SVGElement|String} svg the URL of the SVG file to fetch.
* @param {Function} onLoad the callback function to call once the SVG
* content is loaded from the given URL.
* @return {Item} the newly created Paper.js item containing the converted
* SVG content
*/
draw: function(ctx, matrix, pixelRatio) {