I am trying to remove all the objects on my Canvas without selecting them. The objects in the Canvas include Grouped and Ungrouped object. All the Examples I've seen demonstrate how to delete a single ungroup object.
Canvas.ForEachObject(function(o){
o.remove();
});
Please see the fiddle for an example of what I'm trying to achieve. https://jsfiddle.net/Shane00711/r8su3ya0/
You just need to call
canvas.clear()
it will remove all object
Did you know that canvas.remove can take more than one parameter? So the easiest way should be this one:
canvas.remove(...canvas.getObjects());
Other than canvas.clear this will only remove the objects in the canvas and not also the background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With