2赞
目前遇到和上述一样的问题, 2.0.9 版本
这几个问题都是,都是 touch_end事件没有接收到, 是不是 触发引擎触摸监听的超时机制, 超时的触摸 能否让 touch_cancle监听到
顶一下
在8个月前,2.0.1版本touch_end曾经在iphone机型上无法检测(原因不明,模拟器和安卓机没有问题,苹果表现为切水果的刀刃不会删除,永久停留。因为没有后续更新所以也不清楚往后有什么问题)。现在都会习惯性地吧touch_end和touch_cancle写上。以防万一
问题是 touch_cancle也没有收到, 移动设备上你手指的按下,touchstart = touchend + touchCancle, 问题是,有些touchend 没有收到
我也不太了解,因为项目已经凉了,也没有后续跟进,只是知道出现过这个问题。后续项目也没有出现touchend收不到的情况
最好给个demo,然后说一下在哪些机型上会这样,
里面有 touchstart touchend touchCancle, 目前在h5端上, ios ,android 都会复现
置顶+1
这个问题正在看,有进展我会过来回复。
大家好,是因为在引擎内部有个触摸超时检测,默认是5000ms,
对应枚举cc.macro.TOUCH_TIMEOUT = 5000;
/**
* !#en
* The timeout to determine whether a touch is no longer active and should be removed.
* The reason to add this timeout is due to an issue in X5 browser core,
* when X5 is presented in wechat on Android, if a touch is glissed from the bottom up, and leave the page area,
* no touch cancel event is triggered, and the touch will be considered active forever.
* After multiple times of this action, our maximum touches number will be reached and all new touches will be ignored.
* So this new mechanism can remove the touch that should be inactive if it's not updated during the last 5000 milliseconds.
* Though it might remove a real touch if it's just not moving for the last 5 seconds which is not easy with the sensibility of mobile touch screen.
* You can modify this value to have a better behavior if you find it's not enough.
* !#zh
* 用于甄别一个触点对象是否已经失效并且可以被移除的延时时长
* 添加这个时长的原因是 X5 内核在微信浏览器中出现的一个 bug。
* 在这个环境下,如果用户将一个触点从底向上移出页面区域,将不会触发任何 touch cancel 或 touch end 事件,而这个触点会被永远当作停留在页面上的有效触点。
* 重复这样操作几次之后,屏幕上的触点数量将达到我们的事件系统所支持的最高触点数量,之后所有的触摸事件都将被忽略。
* 所以这个新的机制可以在触点在一定时间内没有任何更新的情况下视为失效触点并从事件系统中移除。
* 当然,这也可能移除一个真实的触点,如果用户的触点真的在一定时间段内完全没有移动(这在当前手机屏幕的灵敏度下会很难)。
* 你可以修改这个值来获得你需要的效果,默认值是 5000 毫秒。
* @property {Number} TOUCH_TIMEOUT
*/
TOUCH_TIMEOUT: 5000,
如果是做类似捕鱼类,射击类的游戏可能会有类似的问题,你们自行在项目上修改一下这个参数即可。
1赞