I have various draggable groups on a kinetic canvas. I need to let a user delete some of these groups.
The first problem is how to actually delete the group (with all its parts) from the canvas.
The second is what kind of UI interaction to use to allow the user to do so. I was thinking to bind dragend, check some condition (eg the position of the object, or some modal variable), and delete the group if the condition is met. Any better suggestions?
Hi for removing all the elemnts of a group I think you can do
yourGroup.removeChildren();
and after(or before ) you can do :
yourGroup.getParent().remove(yourGroup);
to remove the group from is parent.strong text.
For the interaction it really depend of what you are doing, have a trash icon and drag the element in look like the interface in android. you can also have a 'edit mode'. when you are in edit mode you select the group you went work on and after select an action in some button. Like delete, copy... this type of interface will look like a ipad one...
Regarding your question about 'deleting' -- yes, nodes are actually removed. If you want to check for yourself, console.dir(stage) before and after using remove() or destroy() -- either one does the same thing -- then you'll see the node is completely gone. If instead, you intend to keep it for later use, use hide() instead.
Regarding the 'method to test drag and drop on a trash can' check this post:
Dragging collisions