I am using fabricjs 1.6.4 and I want to update the existing svg with the new one. I am using this code to add the new SVG:
fabric.loadSVGFromURL(url, function (objects, options) {
var image = fabric.util.groupSVGElements(objects, options);
image.name = 'sticker';
canvas.add(image);
image.scaleToHeight(100);
image.center();
image['selectable'] = false;
image['evented'] = false;
image.setCoords();
canvas.renderAll();
});
}
How can I replace the existing SVG with the new one. I have done something related to this in the image but I can not replicate in SVG. Here is the code for image:
$scope.fillImage = function(src) {
fabric.Image.fromURL(src, function(img) {
var object = canvas.getActiveObject();
object._element.src = src;
canvas.renderAll();
});
}
I need something like this. Please help.