产品
Egret Engine
版本
5.2.4
复现概率
100%
平台
Android 安卓
复现步骤
创建一个复杂场景,包含大量显示对象,快速连续点击场景
问题描述
当有大量对象在场景上显示时,快速连续点击场景,会出现明显掉帧现象,即使将大多数对象的touchEnable及touchChildren关闭,依然会掉帧
错误代码
源码中DisplayObjectContainer的方法$hitTest(stageX: number, stageY: number): DisplayObject {
if (!this.$visible) { return null; } let m = this.$getInvertedConcatenatedMatrix(); let localX = m.a * stageX + m.c * stageY + m.tx; let localY = m.b * stageX + m.d * stageY + m.ty; let rect = this.$scrollRect ? this.$scrollRect : this.$maskRect; if (rect && !rect.contains(localX, localY)) { return null; } if (this.$mask && !this.$mask.$hitTest(stageX, stageY)) { return null } const children = this.$children; let found = false; let target: DisplayObject = null; for (let i = children.length - 1; i >= 0; i--) { const child = children[i]; if (child.$maskedObject) { continue; } target = child.$hitTest(stageX, stageY); if (target) { found = true; if (target.$touchEnabled) { break; } else { target = null; } } } if (target) { if (this.$touchChildren) { return target; } return this; } if (found) { return this; } return super.$hitTest(stageX, stageY); }
BUG截图
![]()
| |||||||
| |
| |
Powered by Discuz! X3.4 © 2001-2019 Comsenz Inc.