harmony 鸿蒙@ohos.multimodalInput.touchEvent (Touch Event)

2022-08-09 浏览 (913)

@ohos.multimodalInput.touchEvent (Touch Event)

The touchEvent module provides touchscreen 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,ToolType,SourceType,Touch,TouchEvent} from '@ohos.multimodalInput.touchEvent';

Action

Enumerates touch event types.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
CANCEL0Cancellation of touch.
DOWN1Pressing of touch.
MOVE2Moving of touch.
UP3Lifting of touch.

ToolType

Enumerates touch tool types.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
FINGER0Finger
PEN1Stylus
RUBBER2Eraser
BRUSH3Brush
PENCIL4Pencil
AIRBRUSH5Air brush
MOUSE6Mouse
LENS7Lens

SourceType

Enumerates touch source types.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
TOUCH_SCREEN0Touchscreen
PEN1Stylus
TOUCH_PAD2Touchpad

Touch

Defines the touch point information.

System capability: SystemCapability.MultimodalInput.Input.Core

NameTypeReadableWritableDescription
idnumberYesNoTouch event ID.
pressedTimenumberYesNoPress timestamp, in μs.
screenXnumberYesNoX coordinate of the touch position on the screen.
screenYnumberYesNoY coordinate of the touch position on the screen.
windowXnumberYesNoX coordinate of the touch position in the window.
windowYnumberYesNoY coordinate of the touch position in the window.
pressurenumberYesNoPressure value. The value range is [0.0, 1.0]. The value 0.0 indicates that the pressure is not supported.
widthnumberYesNoWidth of the touch area.
heightnumberYesNoHeight of the touch area.
tiltXnumberYesNoAngle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt.
tiltYnumberYesNoAngle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt.
toolXnumberYesNoX coordinate of the center point of the tool area.
toolYnumberYesNoY coordinate of the center point of the tool area.
toolWidthnumberYesNoWidth of the tool area.
toolHeightnumberYesNoHeight of the tool area.
rawXnumberYesNoX coordinate of the input device.
rawYnumberYesNoY coordinate of the input device.
toolTypeToolTypeYesNoTool type.

TouchEvent

Defines a touch event.

System capability: SystemCapability.MultimodalInput.Input.Core

NameTypeReadableWritableDescription
actionActionYesNoTouch event type.
touchTouchYesNoCurrent touch point.
touchesTouch[]YesNoAll touch points.
sourceTypeSourceTypeYesNoTouch source type.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

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