简体   繁体   English

如何在Fabric.js中删除组?

[英]How to delete a group in Fabric.js?

I'm working on a fabric application which features grouping and ungrouping. 我正在研究具有分组和取消分组功能的Fabric应用程序。 I've pretty much handled that logic, however when I ungroup (which consists of duplicating all the grouped elements, and removing the group) the "group" object persists. 我已经很好地处理了这种逻辑,但是当我取消分组(包括复制所有分组的元素并删除分组)时,“ group”对象仍然存在。 It's simply not removed although I am calling the remove method on it. 尽管我正在调用remove方法,但是它并没有被删除。

Alright so I figured it out. 好吧,我明白了。 I was calling remove on the group itself, which wasn't actually doing anything. 我在组本身上调用了remove,实际上并没有做任何事情。 Instead I had to call remove on the canvas and pass it said group. 相反,我必须在画布上调用remove并将其传递给组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM