我正在寻找面料选择清楚事件

I am looking for event in fabricjs for selection clear

本文关键字:选择 清楚 事件 寻找      更新时间:2023-09-26

在我的代码中,我使用了fabricjs事件上创建的选择,现在我正在寻找选择清晰的事件,它是在画布

   canvas.on('selection:created', function(e) {
    activeGroup = canvas.getActiveGroup();
// my code
});

现在我正在寻找

canvas.on('selection:clear', function(e) 

或类似

您可以使用'selection:cleared'事件和'before:selection:cleared'(在'selection:cleared'之前触发的事件)事件,如下所示:

在你的js文件中添加这段代码,你就可以了:

function observe(eventName) {
    logObservingEvent(eventName);
    canvas.on(eventName, function(e){ 
        console.log(eventName) 
     });       
  }
observe('before:selection:cleared');
observe('selection:cleared');

我认为你不需要一个jsfiddle的例子,因为它很简单。

好运。

canvas.on('selection:cleared',function(e){/**Put ur code here...*/});
canvas.on(selection:cleared`, function(e) {/*** your code **/}