Skip to main content

Mouse

A utility class for handling mouse-related events.

Constructors

new Mouse()

new Mouse(): Mouse

Returns

Mouse

Methods

getClientPosition()

static getClientPosition(event): Point

Gets the position of the mouse relative to the viewport (visible area of the browser window).

Parameters

event: MouseEvent

The MouseEvent object that contains the mouse event data.

Returns

Point

A Point object representing the X and Y coordinates relative to the viewport.

Defined in

types/Mouse.ts:24


getOffsetPosition()

static getOffsetPosition(event): Point

Gets the position of the mouse relative to the element that triggered the event.

Parameters

event: MouseEvent

The MouseEvent object that contains the mouse event data.

Returns

Point

A Point object representing the X and Y coordinates relative to the event target.

Defined in

types/Mouse.ts:14


getPagePosition()

static getPagePosition(event): Point

Gets the position of the mouse relative to the entire document, including the scroll position.

Parameters

event: MouseEvent

The MouseEvent object that contains the mouse event data.

Returns

Point

A Point object representing the X and Y coordinates relative to the document.

Defined in

types/Mouse.ts:34


getScreenPosition()

static getScreenPosition(event): Point

Gets the position of the mouse relative to the entire screen (including monitor setup).

Parameters

event: MouseEvent

The MouseEvent object that contains the mouse event data.

Returns

Point

A Point object representing the X and Y coordinates relative to the screen.

Defined in

types/Mouse.ts:44