STUDY/Java Script

Pointer events, Mouse events

The Simpler 2022. 7. 16. 21:24

Pointer events

Much of today's web content assumes the user's pointing device will be a mouse. However, since many devices support other types of pointing input devices, such as pen/stylus and touch surfaces, extensions to the existing pointing device event models are needed. Pointer events address that need.

Note: Pointer events are not available in Web Workers.

Pointer events are DOM events that are fired for a pointing device. They are designed to create a single DOM event model to handle pointing input devices such as a mouse, pen/stylus or touch (such as one or more fingers).

The pointer is a hardware-agnostic device that can target a specific set of screen coordinates. Having a single event model for pointers can simplify creating Web sites and applications and provide a good user experience regardless of the user's hardware. However, for scenarios when device-specific handling is desired, pointer events defines a pointerType property to inspect the device type which produced the event.

 

포인터는 특정 화면 좌표 집합을 대상으로 할 수 있는 하드웨어에 구애받지 않는 장치입니다. 포인터에 대한 단일 이벤트 모델이 있으면 웹 사이트 및 응용 프로그램 작성을 단순화할 수 있으며 사용자의 하드웨어에 관계없이 좋은 사용자 환경을 제공할 수 있습니다. 그러나 장치별 처리가 필요한 시나리오의 경우 포인터 이벤트가 포인터를 정의합니다.이벤트를 생성한 장치 유형을 검사할 속성을 입력합니다.

 

 

The events needed to handle generic pointer input are analogous to mouse events (mousedown/pointerdown, mousemove/pointermove, etc.). Consequently, pointer event types are intentionally similar to mouse event types.

Additionally, a pointer event contains the usual properties present in mouse events (client coordinates, target element, button states, etc.) in addition to new properties for other forms of input: pressure, contact geometry, tilt, etc. In fact, the PointerEvent interface inherits all of the MouseEvent properties, thus facilitating the migration of content from mouse events to pointer events.

번역을 해보면, "사실 PointerEvent 인터페이스는 모든 MouseEvent 속성을 상속하므로 마우스 이벤트에서 포인터 이벤트로 컨텐츠를 쉽게 마이그레이션할 수 있습니다. " 라고 한다. PointerEvent 인터페이스가 MouseEvent 의 모든 부분을 상속 받았다고 한다면, PointEvent 가 조금 더 큰 개념이고, MouseEvent 가 그 안으로 들어가는 개념인 건가?

 

 

Pointer events - Web APIs | MDN

Much of today's web content assumes the user's pointing device will be a mouse. However, since many devices support other types of pointing input devices, such as pen/stylus and touch surfaces, extensions to the existing pointing device event models are ne

developer.mozilla.org