- 注册时间
- 2016-1-19
- 最后登录
- 2019-3-25
- 阅读权限
- 20
- 积分
- 52
- 精华
- 0
- 帖子
- 12
|
InteractivePNG.prototype.hitTestPoint = function (x, y) {
var self = this;
var point = self.getRootCoordinate();
point.x = x - point.x;
point.y = y - point.y;
for (var i = 0, l = self.childList.length; i < l; i++) {
var child = self.childList[0];
if (!child.bitmapData._locked) {
child.bitmapData.lock();
}
var cx = point.x - child.x;
var cy = point.y - child.y;
if (cx < 0 || cx > child.bitmapData.width * child.scaleX || cy < 0 || cy > child.bitmapData.height * child.scaleY) {
continue;
}
var pixel = child.bitmapData.getPixel(Math.round(cx / child.scaleX), Math.round(cy / child.scaleY));
if (pixel && pixel[3] > 0) {
return true;
}
}
return false;
};
我也发现这个问题,自己改了一下这里,初步是可以用的了 |
|