2012-09-13 20:45:27 -04:00
|
|
|
/**
|
|
|
|
* Imports svg into items with groups
|
|
|
|
* Stetson Alpha - Paper.js
|
2012-09-15 19:58:44 -04:00
|
|
|
*
|
2012-09-13 20:45:27 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
var ImportSVG = function()
|
|
|
|
{
|
2012-09-15 19:59:53 -04:00
|
|
|
//initialize
|
|
|
|
function initialize()
|
|
|
|
{
|
2012-09-15 19:58:44 -04:00
|
|
|
|
2012-09-15 19:59:53 -04:00
|
|
|
};
|
2012-09-15 19:58:44 -04:00
|
|
|
|
2012-09-15 19:59:53 -04:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Takes the svg dom obj and parses the data
|
|
|
|
* to create a layer with groups (if needed) with
|
|
|
|
* items inside. Should support nested groups.
|
|
|
|
*
|
|
|
|
* takes in a svg object (xml dom)
|
|
|
|
* returns Paper.js Layer
|
|
|
|
*/
|
2012-09-13 20:45:27 -04:00
|
|
|
this.importSVG = function(svg)
|
|
|
|
{
|
2012-09-15 19:59:53 -04:00
|
|
|
return layer;
|
2012-09-13 20:45:27 -04:00
|
|
|
};
|
2012-09-15 19:58:44 -04:00
|
|
|
|
2012-09-15 19:59:53 -04:00
|
|
|
/**
|
|
|
|
* Creates a Paper.js Group by parsing
|
|
|
|
* a specific svg g node
|
|
|
|
*
|
|
|
|
* takes in a svg object (xml dom)
|
|
|
|
* returns Paper.js Group
|
|
|
|
*/
|
2012-09-13 20:45:27 -04:00
|
|
|
function importGroup(svg)
|
|
|
|
{
|
2012-09-15 19:59:53 -04:00
|
|
|
return group;
|
2012-09-13 20:45:27 -04:00
|
|
|
};
|
2012-09-15 19:58:44 -04:00
|
|
|
|
2012-09-15 19:59:53 -04:00
|
|
|
/**
|
|
|
|
* Creates a Paper.js Path by parsing
|
|
|
|
* a specific svg node (rect, path, circle, polygon, etc)
|
|
|
|
* and creating the right path object based on the svg type.
|
|
|
|
*
|
|
|
|
* takes in a svg object (xml dom)
|
|
|
|
* returns Paper.js Group
|
|
|
|
*/
|
2012-09-13 20:45:27 -04:00
|
|
|
function importPath(svg)
|
|
|
|
{
|
2012-09-15 19:59:53 -04:00
|
|
|
return path;
|
2012-09-13 20:45:27 -04:00
|
|
|
};
|
2012-09-15 19:58:44 -04:00
|
|
|
|
2012-09-13 20:45:27 -04:00
|
|
|
initialize(); // calls the init function after class is loaded
|
|
|
|
};
|