Javascript touch event: distinguishing finger vs. Apple Pencil

后端 未结 2 1246
礼貌的吻别
礼貌的吻别 2021-01-04 15:16

In Mobile Safari, is there any way to distinguish whether a touch event is generated by finger or Apple Pencil?

2条回答
  •  礼貌的吻别
    2021-01-04 16:03

    You can check the touch force with:

    e.touches[0].force;
    

    But it works also for 3DTouch on iPhone 6s.

    Only Apple Pencil events and touches events on iPhone 6s have .force

提交回复
热议问题