PointerEvent()
constructor creates a new synthetic and untrusted
PointerEvent
对象实例。
event = new PointerEvent(type, PointerEventInit);
DOMString
representing the name of the event (see
PointerEvent event types
).
PointerEventInit
字典,拥有以下字段:
pointerId
— optional and defaulting to
0
, of type
long
, that sets the value of the instance's
PointerEvent.pointerId
.
width
— optional and defaulting to
1
, of type
double
, that sets the value of the instance's
PointerEvent.width
.
height
— optional and defaulting to
1
, of type
double
, that sets the value of the instance's
PointerEvent.height
.
pressure
— optional and defaulting to
0
, of type
float
, that sets the value of the instance's
PointerEvent.pressure
.
tangentialPressure
— optional and defaulting to
0
, of type
float
, that sets the value of the instance's
PointerEvent.tangentialPressure
.
tiltX
— optional and defaulting to
0
, of type
long
, that sets the value of the instance's
PointerEvent.tiltX
.
tiltY
— optional and defaulting to
0
, of type
long
, that sets the value of the instance's
PointerEvent.tiltY
.
twist
— optional and defaulting to
0
, of type
long
, that sets the value of the instance's
PointerEvent.twist
.
pointerType
— optional and defaulting to
""
, of type
DOMString
, that sets the value of the instance's
PointerEvent.pointerType
.
isPrimary
— optional and defaulting to
false
, of type
布尔
, that sets the value of the instance's
PointerEvent.isPrimary
.
注意
:
PointerEventInit
字典还接受字段来自
MouseEvent
,
UIEventInit
and
EventInit
字典。
var moveEvent = new PointerEvent("pointermove");
var downEvent = new PointerEvent("pointerdown",
{pointerId: 1,
bubbles: true,
cancelable: true,
pointerType: "touch",
width: 100,
height: 100,
isPrimary: true
});
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
更新 GitHub 上的兼容性数据| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
PointerEvent()
构造函数
|
Chrome 55 | Edge 12 |
Firefox
59
|
IE
11
|
Opera 42 | Safari 13 | WebView Android 55 | Chrome Android 55 | Firefox Android 41 | Opera Android 42 | Safari iOS 13 | Samsung Internet Android 6.0 |
完整支持
见实现注意事项。
用户必须明确启用此特征。
要求使用供应商前缀或不同名称。
PointerEvent
PointerEvent()
Element.ongotpointercapture
Element.onlostpointercapture
Element.releasePointerCapture()
Element.setPointerCapture()
GlobalEventHandlers.onpointercancel
GlobalEventHandlers.onpointerdown
GlobalEventHandlers.onpointerenter
GlobalEventHandlers.onpointerleave
GlobalEventHandlers.onpointermove
GlobalEventHandlers.onpointerout
GlobalEventHandlers.onpointerover
GlobalEventHandlers.onpointerup
Navigator.maxTouchPoints