跳到主要内容

touchstart 触摸开始事件

touchstart

类型: MethodDeclaration

定义位置: ui.ts

描述

触摸开始事件

参数 event: 脚本触摸事件

参数

参数名类型描述默认值
eventScriptTouchEvent--

返回值

类型: void

源代码

位置: 第 778 行

private touchstart(event: ScriptTouchEvent): void {
for (const touch of event.changedTouches) {
const element = UI.getElementAt(touch.screenX, touch.screenY)
ScriptTouchEvent.setTarget(event, touch, element === UI.root ? null : element)
}
for (const copy of ScriptTouchEvent.forEachElement(event)) {
if (copy.target instanceof UIElement) {
Input.bubbles.push(true)
copy.target.emit('touchstart', event, true)
Input.bubbles.pop()
}
}
if (!ScriptTouchEvent.loadGlobalTouchEvent(event)) {
Input.bubbles.stop()
}
}

文档生成时间:2026/2/1 16:51:40