PointerEvent: PointerEvent() コンストラクター
Baseline
Widely available
*
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年7月.
* Some parts of this feature may have varying levels of support.
PointerEvent() コンストラクターは、新しい信頼できない合成 PointerEvent オブジェクトのインスタンスを作成します。
構文
new PointerEvent(type)
new PointerEvent(type, options)
引数
type-
文字列で、イベントの名前を表します(PointerEvent のイベントの種類を参照)。
options省略可-
オブジェクトで、
MouseEvent()で定義されているプロパティに加え、以下のプロパティを設定することができます。pointerId-
数値で、既定値は
0であり、インスタンスのPointerEvent.pointerIdの値を設定します。 width-
数値で、既定値は
1であり、インスタンスのPointerEvent.widthの値を設定します。 height-
数値で、既定値は
1であり、インスタンスのPointerEvent.heightの値を設定します。 pressure-
数値で、既定値は
0であり、インスタンスのPointerEvent.pressureの値を設定します。 tangentialPressure-
数値で、既定値は
0であり、インスタンスのPointerEvent.tangentialPressureの値を設定します。 tiltX-
数値で、既定値は
0であり、インスタンスのPointerEvent.tiltXの値を設定します。 tiltY-
数値で、既定値は
0であり、インスタンスのPointerEvent.tiltYの値を設定します。 twist-
数値で、既定値は
0であり、インスタンスのPointerEvent.twistの値を設定します。 pointerType-
文字列で、既定値は
""であり、インスタンスのPointerEvent.pointerTypeの値を設定します。 isPrimary-
論理値で、既定値は
falseであり、インスタンスのPointerEvent.isPrimaryの値を設定します。
返値
新しい PointerEvent オブジェクトです。
例
const moveEvent = new PointerEvent("pointermove");
const downEvent = new PointerEvent("pointerdown", {
pointerId: 1,
bubbles: true,
cancelable: true,
pointerType: "touch",
width: 100,
height: 100,
isPrimary: true,
});
仕様書
| Specification |
|---|
| Pointer Events> # dom-pointerevent-constructor> |
ブラウザーの互換性
Loading…