openharmony 鸿蒙 js-apis-mouseevent

2025-06-12 浏览 (1)

@ohos.multimodalInput.mouseEvent (Mouse Event)

The mouseEvent module provides mouse events reported by a device. It is inherited from InputEvent.

NOTE

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.

Modules to Import

import { Action, Button, Axis, AxisValue, MouseEvent } from '@kit.InputKit';

Action

Enumerates mouse event types.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
CANCEL0Canceled.
MOVE1Moving of the mouse pointer.
BUTTON_DOWN2Pressing of a mouse button.
BUTTON_UP3Release of a mouse button.
AXIS_BEGIN4Beginning of the mouse axis event.
AXIS_UPDATE5Updating of the mouse axis event.
AXIS_END6Mouse axis event ended.
ACTION_DOWN11+7Finger pressing on the touchpad.
ACTION_UP11+8Finger lift from the touchpad.

Button

Enumerates mouse buttons.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
LEFT0Left button.
MIDDLE1Middle button.
RIGHT2Right button
SIDE3Side button.
EXTRA4Extended button.
FORWARD5Forward button.
BACK6Back button.
TASK7Task button.

Axis

Enumerates mouse axis types.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
SCROLL_VERTICAL0Vertical scroll axis.
SCROLL_HORIZONTAL1Horizontal scroll axis.
PINCH2Pinch axis.

AxisValue

Defines the mouse axis type and axis value.

System capability: SystemCapability.MultimodalInput.Input.Core

NameTypeReadableWritableDescription
axisAxisYesNoAxis type.
valuenumberYesNoAxis value.

ToolType11+

Enumerates tool types.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
UNKNOWN11+0Unknown type.
MOUSE11+1Mouse.
JOYSTICK11+2Joystick.
TOUCHPAD11+3Touchpad.

MouseEvent

Defines the mouse event.

System capability: SystemCapability.MultimodalInput.Input.Core

NameTypeReadableWritableDescription
actionActionYesNoEnumerates mouse event actions.
screenXnumberYesNoHorizontal coordinate of the mouse pointer on the screen.
screenYnumberYesNoVertical coordinate of the mouse pointer on the screen.
windowXnumberYesNoHorizontal coordinate of the mouse pointer in the window.
windowYnumberYesNoVertical coordinate of the mouse pointer in the window.
rawDeltaXnumberYesNoHorizontal coordinate offset relative to the previous reported mouse pointer position.
rawDeltaYnumberYesNoVertical coordinate offset relative to the previous reported mouse pointer position.
buttonButtonYesNoMouse button.
pressedButtonsButton[]YesNoButton being pressed.
axesAxisValue[]YesNoAll axis data contained in the event.
pressedKeysKeyCode[]YesNoList of pressed keys.
ctrlKeybooleanYesNoWhether ctrlKey is being pressed.
The value true indicates that the key is pressed, and the value false indicates the opposite.
altKeybooleanYesNoWhether altKey is being pressed.
The value true indicates that the key is pressed, and the value false indicates the opposite.
shiftKeybooleanYesNoWhether shiftKey is being pressed.
The value true indicates that the key is pressed, and the value false indicates the opposite.
logoKeybooleanYesNoWhether logoKey is being pressed.
The value true indicates that the key is pressed, and the value false indicates the opposite.
fnKeybooleanYesNoWhether fnKey is being pressed.
The value true indicates that the key is pressed, and the value false indicates the opposite.
capsLockbooleanYesNoWhether capsLock is active.
The value true indicates that capsLock is active, and the value false indicates the opposite.
numLockbooleanYesNoWhether numLock is active.
The value true indicates that numLock is active, and the value false indicates the opposite.
scrollLockbooleanYesNoWhether scrollLock is active.
The value true indicates that scrollLock is active, and the value false indicates the opposite.
toolType11+ToolTypeYesNoTool type.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Input Kit

harmony 鸿蒙Input_DeviceListener

harmony 鸿蒙Input_InterceptorEventCallback

harmony 鸿蒙Input_AxisEvent

harmony 鸿蒙Input_DeviceInfo

harmony 鸿蒙Input_DeviceListener

harmony 鸿蒙Input_Hotkey

harmony 鸿蒙Input_InterceptorEventCallback

harmony 鸿蒙Input_InterceptorOptions

harmony 鸿蒙Input_KeyEvent

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/71zagJ