HarmonyOS 手指Move场景下TouchEvent里的touches和changedTouches坐标不相等

手指Move场景下TouchEvent里的touches和changedTouches坐标不相等

操作步骤:

Stack() {

}
.onTouch(e => {
  const touches = JSON.stringify(e.touches)
  const changes = JSON.stringify(e.changedTouches)
  console.log(`touches = ${touches}`)
  console.log(`changes = ${changes}`)
})
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
HarmonyOS
2024-12-26 14:35:54
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
aquaa

touches Array<TouchObject>全部手指信息。

changedTouches Array<TouchObject>当前发生变化的手指信息。

二者是不同的回调函数。changedTouches里的是做过防抖处理,changedTouches里的坐标打印出来比touches里的更加平滑,规格如此

参考文档:

https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/ts-universal-events-touch-V5#touchevent%E5%AF%B9%E8%B1%A1%E8%AF%B4%E6%98%8E

分享
微博
QQ
微信
回复
2024-12-26 16:58:51
相关问题
touchEvent使用方法
7659浏览 • 1回复 待解决
HarmonyOS UI组件怎么设置宽高相等
857浏览 • 1回复 待解决
HarmonyOS部分场景expandSafeArea不生效
1950浏览 • 1回复 待解决
HarmonyOS Navigationrouter使用场景
1601浏览 • 2回复 待解决
HarmonyOS onDidBuild作用应用场景
1038浏览 • 1回复 待解决
HarmonyOS 列表高度不相同布局
728浏览 • 1回复 待解决
分布式场景信任链如何构建?
285浏览 • 0回复 待解决
HarmonyOS 在@State@Prop单向传输场景
633浏览 • 1回复 待解决
HarmonyOS 获取控件坐标
692浏览 • 1回复 待解决