gpt4 book ai didi

javascript - 我正在 fabricjs 中寻找事件以进行选择

转载 作者:行者123 更新时间:2023-11-30 16:51:38 26 4
gpt4 key购买 nike

在我的代码中,我在创建的选择上使用了 fabricjs 事件,现在我正在寻找选择清除事件,它是否在 Canvas 中可用

   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 示例,因为它非常简单。

祝你好运。

关于javascript - 我正在 fabricjs 中寻找事件以进行选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30440975/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com