• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.multimodalInput.mouseEvent (Mouse Event)
2
3The **mouseEvent** module provides mouse events reported by an input device.
4
5> **NOTE**<br>
6> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
7
8## Modules to Import
9
10```js
11import { Action, Button, Axis, AxisValue, MouseEvent } from '@ohos.multimodalInput.mouseEvent';
12```
13
14## Action
15
16Defines a mouse action.
17
18**System capability**: SystemCapability.MultimodalInput.Input.Core
19
20| Name       | Value| Description                |
21| ----------- | -------- | -------------------- |
22| CANCEL      | 0   | Cancellation of a mouse action.            |
23| MOVE        | 1   | Moving of the mouse pointer.            |
24| BUTTON_DOWN | 2   | Pressing of a mouse button.        |
25| BUTTON_UP   | 3   | Release of a mouse button.        |
26| AXIS_BEGIN  | 4   | Beginning of the axis event associated with the mouse.|
27| AXIS_UPDATE | 5   | Updating of the axis event associated with the mouse.|
28| AXIS_END    | 6   | Ending of the axis event associated with the mouse.|
29
30
31## Button
32
33Enumerates mouse actions.
34
35**System capability**: SystemCapability.MultimodalInput.Input.Core
36
37| Name     | Value | Description   |
38| ------- | ------| ----- |
39| LEFT    | 0 | Left button on the mouse. |
40| MIDDLE  | 1 | Middle button on the mouse. |
41| RIGHT   | 2 | Right button on the mouse. |
42| SIDE    | 3 | Side button on the mouse.|
43| EXTRA   | 4 | Extended button on the mouse.|
44| FORWARD | 5 | Forward button on the mouse.|
45| BACK    | 6 | Back button on the mouse.|
46| TASK    | 7 | Task button on the mouse.|
47
48## Axis
49
50Enumerates mouse axis types.
51
52**System capability**: SystemCapability.MultimodalInput.Input.Core
53
54| Name               | Value    | Description   |
55| ----------------- | ------- | ----- |
56| SCROLL_VERTICAL   | 0 | Vertical scroll axis.|
57| SCROLL_HORIZONTAL | 1 | Horizontal scroll axis.|
58| PINCH             | 2 | Pinch axis.  |
59
60
61## AxisValue
62
63Defines a mouse axis type and value.
64
65**System capability**: SystemCapability.MultimodalInput.Input.Core
66
67| Name   | Type  | Readable  | Writable  | Description  |
68| ----- | ------ | ---- | ---- | ---- |
69| axis  | Axis   | Yes   | No   | Axis type. |
70| value | number | Yes   | No   | Axis value. |
71
72
73## MouseEvent
74
75Defines a mouse event.
76
77**System capability**: SystemCapability.MultimodalInput.Input.Core
78
79| Name            | Type       | Readable  | Writable  | Description                                      |
80| -------------- | ----------- | ---- | ---- | ---------------------------------------- |
81| action         | Action      | Yes   | No   | Mouse event action.                                  |
82| screenX        | number      | Yes   | No   | Horizontal coordinate of the mouse pointer on the screen.                            |
83| screenY        | number      | Yes   | No   | Vertical coordinate of the mouse pointer on the screen.                            |
84| windowX        | number      | Yes   | No   | Horizontal coordinate of the mouse pointer in the window.                              |
85| windowY        | number      | Yes   | No   | Vertical coordinate of the mouse pointer in the window.                              |
86| rawDeltaX      | number      | Yes   | No   | Horizontal coordinate offset relative to the previous reported mouse pointer position.|
87| rawDeltaY      | number      | Yes   | No   | Vertical coordinate offset relative to the previous reported mouse pointer position.                         |
88| button         | Button      | Yes   | No   | Mouse button
89| pressedButtons | Button[]    | Yes   | No   | Button being pressed.                             |
90| axes           | AxisValue[] | Yes   | No   | All axis data contained in the event.                              |
91| pressedKeys    | KeyCode[]   | Yes   | No   | List of pressed keys.                           |
92| ctrlKey        | boolean     | Yes   | No   | Whether ctrlKey is being pressed.                       |
93| altKey         | boolean     | Yes   | No   | Whether altKey is being pressed.                        |
94| shiftKey       | boolean     | Yes   | No   | Whether shiftKey is being pressed.                      |
95| logoKey        | boolean     | Yes   | No   | Whether logoKey is being pressed.                       |
96| fnKey          | boolean     | Yes   | No   | Whether fnKey is being pressed.                         |
97| capsLock       | boolean     | Yes   | No   | Whether capsLock is active.                      |
98| numLock        | boolean     | Yes   | No   | Whether numLock is active.                       |
99| scrollLock     | boolean     | Yes   | No   | Whether scrollLock is active.                    |
100