Let user delete a selected fabric js object

后端 未结 5 776
青春惊慌失措
青春惊慌失措 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:55

    you can delete active object by using backspace key

    $(document).keydown(function(event){
        if (event.which == 8) {
            if (canvas.getActiveObject()) {
                canvas.getActiveObject().remove();
            }
        }
    });
    

提交回复
热议问题