PointerEvent
マウスやタッチパネル、ペンなどの実際のハードウェアに依らない、一般的なpointing deviceのイベントを表すクラス
MouseEventを継承している
TouchEventは継承していない
かなり詳しい情報を得ることができる
接触座標
接触圧力
接線圧力
ペンの傾き
ねじれ
デバイスの種類
複数のポインタの識別にはisPrimaryを使う
同時に使用可能なポインタの最大数はnavigator.maxTouchPointsから取得できる
from PointerEvent インターフェイス | Pointer events - Web API | MDN
要素からpointerが離れてもeventをcaptureできる仕組みがある
ポインタキャプチャ | Pointer events - Web API | MDN
event type
MouseEventと同等のもの
pointerover
pointerenter
pointerdown
pointermove
pointerup
pointerout
pointerleave
PointerEvent独自のもの
pointercancel
gotpointercapture
lostpointercapture
from イベントタイプとグローバルイベントハンドラ | Pointer events - Web API | MDN
実装状況
主要なbrowser全てで実装済み
MouseEventより100億倍便利じゃんtakker.icon*3
このイベントで検知できる値を表示できるdemo appを作っておきたいtakker.icon
References
Pointer events - Web API | MDN
PointerEvent - Web API | MDN
#2021-06-30 08:12:15
#2021-04-13