(container: GComponent, stageX: number, stageY: number)
| 434 | } |
| 435 | |
| 436 | private hitTestInChildren(container: GComponent, stageX: number, stageY: number): GObject | null { |
| 437 | const count = container.numChildren; |
| 438 | for (let i = count - 1; i >= 0; i--) { |
| 439 | const child = container.getChildAt(i); |
| 440 | if (!child.visible || !child.touchable) continue; |
| 441 | |
| 442 | const local = child.globalToLocal(stageX, stageY); |
| 443 | if (local.x >= 0 && local.x < child.width && local.y >= 0 && local.y < child.height) { |
| 444 | if (child instanceof GComponent) { |
| 445 | const deeper = this.hitTestInChildren(child, stageX, stageY); |
| 446 | if (deeper) return deeper; |
| 447 | } |
| 448 | return child; |
| 449 | } |
| 450 | } |
| 451 | return null; |
| 452 | } |
| 453 | |
| 454 | public onMouseDown(data: IInputEventData): void { |
| 455 | this._touchTarget = this.hitTest(data.stageX, data.stageY); |
no test coverage detected