Grouping SVG element and groups using JavaScript
Hi
You have to
1- create group with group = document.createElementNS(null,"g")
give id to this group group.setAttributeNS(null,"id","MyGroup")
append group to main svg document.rootElement.appendChild(group)
2- clone node to put in group with new_node=evt.target.cloneNode(true)
3- append new node to group document.getElementById("MyGroup").appendChild(new _node)
4- delete moved node with evt.target.parentNode.removeChild(evt.target)
You can adapt script with where put group in DOM tree.
Michel |