当前位置:   article > 正文

鸿蒙开发之 组合手势 中两指捏和手势不识别的问题

鸿蒙开发之 组合手势 中两指捏和手势不识别的问题

创建手势组合

  1. .gesture(
  2. GestureGroup(GestureMode.Parallel,
  3. PinchGesture({ count: 2 })
  4. .onActionStart((event: GestureEvent|undefined) => {
  5. console.info('Pinch start');
  6. })
  7. PanGesture(this.panOption)
  8. .onActionStart((event?: GestureEvent) => {
  9. })
  10. )

实现效果是两指捏和,单指移动。

可是只有单指移动是好用的,代码如下

  1. .gesture(
  2. GestureGroup(GestureMode.Parallel,
  3. // PinchGesture({ count: 2 })
  4. // .onActionStart((event: GestureEvent|undefined) => {
  5. // console.info('Pinch start');
  6. // })
  7. PanGesture(this.panOption)
  8. .onActionStart((event?: GestureEvent) => {
  9. })
  10. )

只要两个同时存在就会导致异常

解决办法

将 count 改为 fingers ,

fingers 才表示识别两个手指的操作

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/300389
推荐阅读
相关标签
  

闽ICP备14008679号