PointerEvent

open class PointerEvent(val type: EventType<PointerEvent>, init: PointerEventInit = definedExternally) : MouseEvent(source)

The PointerEvent interface represents the state of a DOM event produced by a pointer such as the geometry of the contact point, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc.

MDN Reference

Constructors

Link copied to clipboard
constructor(type: EventType<PointerEvent>, init: PointerEventInit = definedExternally)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
external val altitudeAngle: Double

The altitudeAngle read-only property of the PointerEvent interface represents the angle between a transducer (a pointer or stylus) axis and the X-Y plane of a device screen. The altitude angle describes whether the transducer is perpendicular to the screen, parallel, or at some angle in between.

Link copied to clipboard
external val altKey: Boolean

The MouseEvent.altKey read-only property is a boolean value that indicates whether the alt key was pressed or not when a given mouse event occurs.

Link copied to clipboard
external val azimuthAngle: Double

The azimuthAngle read-only property of the PointerEvent interface represents the angle between the Y-Z plane and the plane containing both the transducer (pointer or stylus) axis and the Y axis.

Link copied to clipboard
external val bubbles: Boolean
Link copied to clipboard
external val button: MouseButton

The MouseEvent.button read-only property indicates which button was pressed or released on the mouse to trigger the event.

Link copied to clipboard
external val buttons: MouseButtons

The MouseEvent.buttons read-only property indicates which buttons are pressed on the mouse (or other input device) when a mouse event is triggered.

Link copied to clipboard
external val cancelable: Boolean
Link copied to clipboard
external val clientX: Int

The clientX read-only property of the MouseEvent interface provides the horizontal coordinate within the application's viewport at which the event occurred (as opposed to the coordinate within the page).

Link copied to clipboard
external val clientY: Int

The clientY read-only property of the MouseEvent interface provides the vertical coordinate within the application's viewport at which the event occurred (as opposed to the coordinate within the page).

Link copied to clipboard
external val composed: Boolean
Link copied to clipboard
external val ctrlKey: Boolean

The MouseEvent.ctrlKey read-only property is a boolean value that indicates whether the ctrl key was pressed or not when a given mouse event occurs.

Link copied to clipboard
external val currentTarget: EventTarget?
Link copied to clipboard
Link copied to clipboard
external val detail: Int

The UIEvent.detail read-only property, when non-zero, provides the current (or next, depending on the event) click count.

Link copied to clipboard
external val eventPhase: EventPhase
Link copied to clipboard
external val height: Double

The height read-only property of the PointerEvent interface represents the height of the pointer's contact geometry, along the y-axis (in CSS pixels). Depending on the source of the pointer device (for example a finger), for a given pointer, each event may produce a different value.

Link copied to clipboard
external val isPrimary: Boolean

The isPrimary read-only property of the PointerEvent interface indicates whether or not the pointer device that created the event is the primary pointer. It returns true if the pointer that caused the event to be fired is the primary one and returns false otherwise.

Link copied to clipboard
external val isTrusted: Boolean
Link copied to clipboard
external val layerX: Int

The MouseEvent.layerX read-only property returns the horizontal coordinate of the event relative to the current layer.

Link copied to clipboard
external val layerY: Int

The MouseEvent.layerY read-only property returns the vertical coordinate of the event relative to the current layer.

Link copied to clipboard
external val metaKey: Boolean

The MouseEvent.metaKey read-only property is a boolean value that indicates whether the meta key was pressed or not when a given mouse event occurs.

Link copied to clipboard
external val movementX: Double

The movementX read-only property of the MouseEvent interface provides the difference in the X coordinate of the mouse (or pointer) between the given move event and the previous move event of the same type.

Link copied to clipboard
external val movementY: Double

The movementY read-only property of the MouseEvent interface provides the difference in the Y coordinate of the mouse (or pointer) between the given move event and the previous move event of the same type.

Link copied to clipboard
external val offsetX: Double

The offsetX read-only property of the MouseEvent interface provides the offset in the X coordinate of the mouse pointer between that event and the padding edge of the target node.

Link copied to clipboard
external val offsetY: Double

The offsetY read-only property of the MouseEvent interface provides the offset in the Y coordinate of the mouse pointer between that event and the padding edge of the target node.

Link copied to clipboard
external val pageX: Double

The pageX read-only property of the MouseEvent interface returns the X (horizontal) coordinate (in pixels) at which the mouse was clicked, relative to the left edge of the entire document. This includes any portion of the document not currently visible.

Link copied to clipboard
external val pageY: Double

The pageY read-only property of the MouseEvent interface returns the Y (vertical) coordinate (in pixels) at which the mouse was clicked, relative to the top edge of the entire document. This includes any portion of the document not currently visible.

Link copied to clipboard
external val persistentDeviceId: Int

The persistentDeviceId read-only property of the PointerEvent interface is a unique identifier for the pointing device generating the PointerEvent. This provides a secure, reliable way to identify multiple pointing devices (such as pens) interacting with the screen simultaneously.

Link copied to clipboard
external val pointerId: Int

The pointerId read-only property of the PointerEvent interface is an identifier assigned to the pointer that triggered the event. The identifier is unique, being different from the identifiers of all other active pointer events.

Link copied to clipboard
external val pointerType: String

The pointerType read-only property of the PointerEvent interface indicates the device type (mouse, pen, or touch) that caused a given pointer event.

Link copied to clipboard
external val pressure: Float

The pressure read-only property of the PointerEvent interface indicates the normalized pressure of the pointer input.

Link copied to clipboard
external val relatedTarget: EventTarget?

The MouseEvent.relatedTarget read-only property is the secondary target for the mouse event, if there is one.

Link copied to clipboard
external val screenX: Int

The screenX read-only property of the MouseEvent interface provides the horizontal coordinate (offset) of the mouse pointer in screen coordinates.

Link copied to clipboard
external val screenY: Int

The screenY read-only property of the MouseEvent interface provides the vertical coordinate (offset) of the mouse pointer in screen coordinates.

Link copied to clipboard
external val shiftKey: Boolean

The MouseEvent.shiftKey read-only property is a boolean value that indicates whether the shift key was pressed or not when a given mouse event occurs.

Link copied to clipboard

The tangentialPressure read-only property of the PointerEvent interface represents the normalized tangential pressure of the pointer input (also known as barrel pressure or cylinder stress).

Link copied to clipboard
external val target: EventTarget?
Link copied to clipboard
external val tiltX: Int

The tiltX read-only property of the PointerEvent interface is the angle (in degrees) between the Y-Z plane of the pointer and the screen. This property is typically only useful for a pen/stylus pointer type.

Link copied to clipboard
external val tiltY: Int

The tiltY read-only property of the PointerEvent interface is the angle (in degrees) between the X-Z plane of the pointer and the screen. This property is typically only useful for a pen/stylus pointer type.

Link copied to clipboard
Link copied to clipboard
external val twist: Int

The twist read-only property of the PointerEvent interface represents the clockwise rotation of the pointer (e.g., pen stylus) around its major axis, in degrees.

Link copied to clipboard
open external override val type: EventType<PointerEvent>
Link copied to clipboard
external val view: Window?

The UIEvent.view read-only property returns the WindowProxy object from which the event was generated. In browsers, this is the Window object the event happened in.

Link copied to clipboard
external val width: Double

The width read-only property of the PointerEvent interface represents the width of the pointer's contact geometry along the x-axis, measured in CSS pixels. Depending on the source of the pointer device (such as a finger), for a given pointer, each event may produce a different value.

Link copied to clipboard
external val x: Double

The MouseEvent.x property is an alias for the MouseEvent.clientX property.

Link copied to clipboard
external val y: Double

The MouseEvent.y property is an alias for the MouseEvent.clientY property.

Functions

Link copied to clipboard
Link copied to clipboard

The getCoalescedEvents() method of the PointerEvent interface returns a sequence of PointerEvent instances that were coalesced (merged) into a single pointermove or pointerrawupdate event. Instead of a stream of many pointermove events, user agents coalesce multiple updates into a single event. This helps with performance as the user agent has less event handling to perform, but there is a reduction in the granularity and accuracy when tracking, especially with fast and large movements. Available only in secure contexts.

Link copied to clipboard

The MouseEvent.getModifierState() method returns the current state of the specified modifier key: true if the modifier is active (i.e., the modifier key is pressed or locked), otherwise, false.

Link copied to clipboard

The getPredictedEvents() method of the PointerEvent interface returns a sequence of PointerEvent instances that are estimated future pointer positions. How the predicted positions are calculated depends on the user agent, but they are based on past points, current velocity, and trajectory.

Link copied to clipboard
external fun preventDefault()
Link copied to clipboard
Link copied to clipboard
external fun stopPropagation()