alpha = 0时CreateJS getObjectsUnderPoint [英] CreateJS getObjectsUnderPoint when alpha = 0

查看:115
本文介绍了alpha = 0时CreateJS getObjectsUnderPoint的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将所有位图放在容器中。位图alpha设置为0,这种方法似乎不起作用。

I need to get all bitmaps under point in a container. The bitmaps alpha is set to 0 and this doesnt seem to work with this method.

还有其他选择吗?我不能仅向对象添加事件侦听器,因为在这种情况下这还不够。

Are there any alternatives? I cant just add an event listener to the object as that is not enough in this scenario.

谢谢

推荐答案

1)如果只想将对象放在某个点下,则必须遍历容器的所有子级,然后调用 hitTest(x,y) http://www.createjs.com/ Docs / EaselJS / classes / DisplayObject.html#method_hitTest ),它将忽略alpha值。 (切记使用对象的局部坐标空间中的坐标来调用该方法)

1) If you just want to get the objects under a point you'd have to loop through all children of the container and call hitTest(x,y) (http://www.createjs.com/Docs/EaselJS/classes/DisplayObject.html#method_hitTest) this ignores the alpha-value. (remember to call the method with the coordinates in the object's local coordinate space)

2)如果要使用EventListeners和Alpha-0对象,则可以定义另一个对象DisplayObject作为 hitArea http://www.createjs.com/Docs/EaselJS/classes/DisplayObject.html#property_hitArea )-在这种情况下,仅使用hitArea对象的形状,字母等。

2) If you want to work with EventListeners and Alpha-0 objects, you can define another DisplayObject as the hitArea (http://www.createjs.com/Docs/EaselJS/classes/DisplayObject.html#property_hitArea) - in that case only the shape, alpha, ect.. of the hitArea object is used.

这篇关于alpha = 0时CreateJS getObjectsUnderPoint的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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