如何让用户删除dynamicjs中的一组对象? [英] How to let a user delete a group of objects in kineticjs?

查看:89
本文介绍了如何让用户删除dynamicjs中的一组对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在动态画布上有各种可拖动的组.我需要让用户删除其中一些组.

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.

第二个是允许用户使用哪种类型的UI交互.我当时正在考虑绑定dragend,检查某些条件(例如,对象的位置或某些模态变量),并在满足条件的情况下删除该组.有更好的建议吗?

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();

yourGroup.removeChildren();

在之后(或之前),您可以执行以下操作:

and after(or before ) you can do :

yourGroup.getParent().remove(yourGroup);

yourGroup.getParent().remove(yourGroup);

要从其中删除该组是parent.strong文本.

to remove the group from is parent.strong text.

对于交互,它实际上取决于您在做什么,有一个废纸icon图标,然后将元素拖动成类似于android中的界面.您还可以使用编辑模式".当您处于编辑模式时,您可以选择要进行工作的组,然后在某个按钮中选择一个动作.就像删除,复制...这种类型的界面看起来就像是ipad一样...

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...

这篇关于如何让用户删除dynamicjs中的一组对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆