svg.js
svg.js copied to clipboard
ungroup() reorders nodes
Bug report
Fiddle
https://jsfiddle.net/3rof824w/
var canvas = SVG().addTo('#canvas').size('100%', '100%')
g = canvas.group()
g.add(canvas.rect(100, 100).move(50,50).fill('red'))
canvas.rect(100, 100).move(100, 100).fill('blue')
g.ungroup()
Explanation
Ungrouping g
brings the red square to the front, because it is inserted after the blue square. I would expect ungrouped nodes to be inserted at the position of the original group.
FYI here is my implementation:
function ungroup_in_place(g) {
for (let e of g.children())
g.before(e);
g.remove();
}
good catch
seems like this was fixed long time ago