[]为什么hitTestPoint始终是false?


class TestUI extends Laya.Sprite {
private s:Laya.Sprite = new Laya.Sprite();
constructor() {
super();
var img:Laya.Image = new Laya.Image("comp/bg.png");
this.s.addChild(img);
this.addChild(this.s);
Laya.stage.on(Laya.Event.CLICK, this, this.hitPoint);
}

private hitPoint(e:Laya.Event): void {
console.log(this.s.hitTestPoint(e.stageX, e.stageY));
}
}

很简单的代码,不知道什么hitTestPoint始终得到的是false.我打印出s的宽高也都是0,但bounds是有有效矩形的。
已邀请:

Monica - 知识达人

赞同来自:

你好
    Sprite的宽高默认是0,需要手动设置宽高

要回复问题请先

商务合作
商务合作