egret-labs / egret-core

Egret is a brand new open mobile game and application engine which allows you to quickly build mobile games and apps on Android,iOS and Windows.
http://www.egret.com
Other
3.92k stars 795 forks source link

eui 双层group 嵌套时 设置scale为0时,group点击区域会放大至全屏 #405

Closed yzliua closed 3 years ago

yzliua commented 3 years ago

版本 5.4.0、5.3.10、5.2.33均可100%复现 测试代码如下:

private async runGame() {
    await this.loadResource()

    const rect = new eui.Rect(this.width, this.height, 0x000000);
    rect.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
        alert('rect')
        group2.scaleX = group2.scaleY = 1;
    }, this)
    this.addChild(rect);

    const label = new eui.Label('hello world');
    label.x = this.width / 2 - label.width / 2;
    label.y = this.height / 2 - label.height / 2

    const group = new eui.Group();
    group.addChild(label);

    const group2 = new eui.Group();
    group2.addChild(group)

    group2.scaleX = group2.scaleY = 0;
    group2.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
        alert('group2')
    }, this)

    this.addChild(group2)
}
jQstone commented 3 years ago

改了后也有问题 修改没有判断touchChildren 会导致没法正确的查找到点击事件目标