Let user delete a selected fabric js object

后端 未结 5 759
青春惊慌失措
青春惊慌失措 2021-02-05 02:03

I have a simple fabric js based application where I will let users add shapes connect them and animate them.

Following is my JS

var canvas; 
window.newA         


        
5条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 02:44

    Delete all selected objects:

    canvas.getActiveObjects().forEach((obj) => {
      canvas.remove(obj)
    });
    canvas.discardActiveObject().renderAll()
    

提交回复
热议问题