外观
touch 模块
本页根据当前原生参数检查、Lua 包装层和返回栈核验。源码核验不代表目标设备已验收。
[参数] 表示可选参数;... 仅用于实现确实接收可变参数的接口。重载分别列出。
模块加载:local touch = require("touch")
touch.init
lua
touch.init(orientation)设置触摸旋转坐标系;方向枚举与 screen 一致。
返回:previousOrientation。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:183;状态:签名已按源码复核,真机待验证。
touch.init_home_on_bottom
lua
touch.init_home_on_bottom()touch.init_home_on_bottom 的参数与返回值已按当前实现核验。
返回:previousOrientation。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:203;状态:签名已按源码复核,真机待验证。
touch.init_home_on_right
lua
touch.init_home_on_right()touch.init_home_on_right 的参数与返回值已按当前实现核验。
返回:previousOrientation。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:215;状态:签名已按源码复核,真机待验证。
touch.init_home_on_left
lua
touch.init_home_on_left()touch.init_home_on_left 的参数与返回值已按当前实现核验。
返回:previousOrientation。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:227;状态:签名已按源码复核,真机待验证。
touch.init_home_on_top
lua
touch.init_home_on_top()touch.init_home_on_top 的参数与返回值已按当前实现核验。
返回:previousOrientation。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:239;状态:签名已按源码复核,真机待验证。
touch.orientation
lua
touch.orientation()touch.orientation 的参数与返回值已按当前实现核验。
返回:orientation。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:251;状态:签名已按源码复核,真机待验证。
touch.size
lua
touch.size()touch.size 的参数与返回值已按当前实现核验。 源码契约:原生屏幕尺寸,不随方向交换。
返回:width, height。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:295;状态:签名已按源码复核,真机待验证。
touch.rotate_xy
lua
touch.rotate_xy(x, y, orientation)touch.rotate_xy 的参数与返回值已按当前实现核验。
返回:x, y。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:308;状态:签名已按源码复核,真机待验证。
touch.is
lua
touch.is(value)touch.is 的参数与返回值已按当前实现核验。
返回:boolean。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:670;状态:签名已按源码复核,真机待验证。
touch.on
lua
touch.on(x, y)
touch.on(finger, x, y [, extraMask])自动分配手指并返回触摸流对象;可链式移动并调用 :off() 释放。另有显式手指编号重载。 源码契约:二参数自动分配手指并返回触摸流;三/四参数使用指定 finger,成功无返回值。
返回:two arguments: touchStream; three or four arguments: no return。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:679;状态:签名已按源码复核,真机待验证。
touch.down
lua
touch.down(x, y)
touch.down(finger, x, y [, extraMask])touch.down 的参数与返回值已按当前实现核验。 源码契约:二参数自动分配手指并返回触摸流;三/四参数使用指定 finger,成功无返回值。
返回:two arguments: touchStream; three or four arguments: no return。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:679;状态:签名已按源码复核,真机待验证。
touch.move
lua
touch.move(fingerOrStream, x, y [, pressure, twist, extraMask])! 模拟手指在屏幕上移动 (:move)。
返回:touchStream when given stream; otherwise no return。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:795;状态:签名已按源码复核,真机待验证。
touch.off
lua
touch.off(fingerOrStream [, x, y, extraMask])模拟手指离开屏幕 (:off)。
返回:无返回值。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1049;状态:签名已按源码复核,真机待验证。
touch.up
lua
touch.up(fingerOrStream [, x, y, extraMask])touch.up 的参数与返回值已按当前实现核验。
返回:无返回值。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1049;状态:签名已按源码复核,真机待验证。
touch.tap
lua
touch.tap(x, y [, downMs, afterMs])按下再抬起;默认按住 30 毫秒,结束后等待 0 毫秒。坐标在 touch 当前旋转坐标系中。 源码契约:downMs 默认 30,afterMs 默认 0。
返回:无返回值。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1343;状态:签名已按源码复核,真机待验证。
touch.show_pose
lua
touch.show_pose(enabled)设置触摸圆点显示 (touch.show_pose)。
返回:无返回值。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1715;状态:签名已按源码复核,真机待验证。
touch:move
lua
touch:move(x, y [, pressure, twist, extraMask])! 模拟手指在屏幕上移动 (:move)。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:795;状态:签名已按源码复核,真机待验证。
touch:press
lua
touch:press([pressure, twist, extraMask])! 模拟手指在屏幕上施加压力 (:press)。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:976;状态:签名已按源码复核,真机待验证。
touch:off
lua
touch:off([x, y, extraMask])模拟手指离开屏幕 (:off)。
返回:无返回值。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1049;状态:签名已按源码复核,真机待验证。
touch:step_len
lua
touch:step_len([pixels])设置触摸事件对象移动步长 (:step_len)。 源码契约:默认 2。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:621;状态:签名已按源码复核,真机待验证。
touch:step_delay
lua
touch:step_delay([milliseconds])设置触摸事件对象移动每步延迟 (:step_delay)。 源码契约:默认 0.1。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:635;状态:签名已按源码复核,真机待验证。
touch:animation
lua
touch:animation([animation])touch:animation 的参数与返回值已按当前实现核验。 源码契约:默认 "linear"。支持 "linear"、"curve"。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:649;状态:签名已按源码复核,真机待验证。
touch:sleep
lua
touch:sleep([seconds])touch:sleep 的参数与返回值已按当前实现核验。 源码契约:默认 0.0001。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1169;状态:签名已按源码复核,真机待验证。
touch:msleep
lua
touch:msleep([milliseconds])! 毫秒级延迟 (:msleep)。 源码契约:默认 0.1。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1232;状态:签名已按源码复核,真机待验证。
touch:delay
lua
touch:delay([milliseconds])touch:delay 的参数与返回值已按当前实现核验。 源码契约:默认 0.1。
返回:touchStream。
核对依据:touch/bridge/SimulateTouchLuaBridge.mm:1232;状态:签名已按源码复核,真机待验证。
