Windows 앱
콘텐츠의 테이블 축소
콘텐츠의 테이블 확장
EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

pointerType property

Returns whether the source of the event is touch, pen or mouse.

This property is read-only.

Syntax

JavaScript
ptr = object.pointerType

 

Property values

Type: Any

touch

The PointerEvent originated from touch input.

pen

The PointerEvent originated from pen input.

mouse

The PointerEvent originated from mouse input.

"" (empty string)

The PointerEvent originated from an unknown input type.

Remarks

Note  This item described in this topic requires Windows 8 or later.
 

In Windows 8.1, this property has been changed to return a string value. In Windows 8, it provided a return value of type long:

  • MSPOINTER_TYPE_TOUCH: 0x00000002
  • MSPOINTER_TYPE_PEN: 0x00000003
  • MSPOINTER_TYPE_MOUSE: 0x00000004

In Internet Explorer 11, this property has been changed to return a string value. In a Windows Store app using JavaScript, it provided a return type of long:

  • MSPOINTER_TYPE_TOUCH: 0x00000002
  • MSPOINTER_TYPE_PEN: 0x00000003
  • MSPOINTER_TYPE_MOUSE: 0x00000004

The following example uses pointerType to check whether a pointer is primary from inside events other than onmspointerdown.


elm.addEventListener("pointerdown",handleDown,false);
function handleDown(evt) {
  if(evt.pointerType == "touch") {
    // Do something for touch input only
  }else{
    // Do something for non-touch input
  }
}


See also

PointerEvent
isPrimary

 

 

표시:
© 2016 Microsoft