Added ability to include children in the json to addSvgElementFromJson().
parent
2246052141
commit
b301acf716
|
@ -188,7 +188,7 @@ var selectedElements = [];
|
|||
// * curStyles - Boolean indicating that current style attributes should be applied first
|
||||
//
|
||||
// Returns: The new element
|
||||
var addSvgElementFromJson = this.addSvgElementFromJson = function(data) {
|
||||
var addSvgElementFromJson = this.addSvgElementFromJson = function addSvgElementFromJson(data) {
|
||||
var shape = svgedit.utilities.getElem(data.attr.id);
|
||||
// if shape is a path but we need to create a rect/ellipse, then remove the path
|
||||
var current_layer = getCurrentDrawing().getCurrentLayer();
|
||||
|
@ -218,6 +218,12 @@ var addSvgElementFromJson = this.addSvgElementFromJson = function(data) {
|
|||
}
|
||||
svgedit.utilities.assignAttributes(shape, data.attr, 100);
|
||||
svgedit.utilities.cleanupElement(shape);
|
||||
|
||||
// Children
|
||||
if(data.children) data.children.forEach(function(child){
|
||||
shape.appendChild(addSvgElementFromJson(child));
|
||||
});
|
||||
|
||||
return shape;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue