• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (c) 2022 Huawei Device Co., Ltd.
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7* http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15import { InputEvent } from './@ohos.multimodalInput.inputEvent'
16
17/**
18 * Action
19 *
20 * @since 9
21 * @syscap SystemCapability.MultimodalInput.Input.Core
22 */
23export declare enum Action {
24  /**
25   * Touch cancelled
26   */
27  CANCEL = 0,
28
29  /**
30   * Touch pressed
31   */
32  DOWN = 1,
33
34  /**
35   * Touch moved
36   */
37  MOVE = 2,
38
39  /**
40   * Touch lifted
41   */
42  UP = 3,
43}
44
45/**
46 * ToolType
47 *
48 * @since 9
49 * @syscap SystemCapability.MultimodalInput.Input.Core
50 */
51export declare enum ToolType {
52  /**
53   * Finger
54   */
55  FINGER = 0,
56
57  /**
58   * Stylus
59   */
60  PEN = 1,
61
62  /**
63   * Rubber
64   */
65  RUBBER = 2,
66
67  /**
68   * Brush
69   */
70  BRUSH = 3,
71
72  /**
73   * Pencil
74   */
75  PENCIL = 4,
76
77  /**
78   * Air brush
79   */
80  AIRBRUSH = 5,
81
82  /**
83   * Mouse
84   */
85  MOUSE = 6,
86
87  LENS = 7,
88}
89
90/**
91 * SourceType
92 *
93 * @since 9
94 * @syscap SystemCapability.MultimodalInput.Input.Core
95 */
96export declare enum SourceType {
97  /**
98   * Touchscreen
99   */
100  TOUCH_SCREEN = 0,
101
102  /**
103   * Stylus
104   */
105  PEN = 1,
106
107  /**
108   * Touchpad
109   */
110  TOUCH_PAD = 2,
111}
112
113/**
114 * Touch
115 *
116 * @since 9
117 * @syscap SystemCapability.MultimodalInput.Input.Core
118 */
119export declare interface Touch {
120  /**
121   * Pointer identifier
122   */
123  id: number;
124
125  /**
126   * Time stamp when touch is pressed
127   */
128  pressedTime: number;
129
130  /**
131   * X coordinate of the touch position on the screen
132   */
133  screenX: number;
134
135  /**
136   * Y coordinate of the touch position on the screen
137   */
138  screenY: number;
139
140  /**
141   * X coordinate of the touch position in the window
142   */
143  windowX: number;
144
145  /**
146   * Y coordinate of the touch position in the window
147   */
148  windowY: number;
149
150  /**
151   * Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates that the pressure is not supported.
152   */
153  pressure: number;
154
155  /**
156   * Width of the contact area when touch is pressed
157   */
158  width: number;
159
160  /**
161   * Height of the contact area when touch is pressed
162   */
163  height: number;
164
165  /**
166   * Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt.
167   */
168  tiltX: number;
169
170  /**
171   * Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt.
172   */
173  tiltY: number;
174
175  /**
176   * Center point X of the tool area
177   */
178  toolX: number;
179
180  /**
181   * Center point Y of the tool area
182   */
183  toolY: number;
184
185  /**
186   * Width of the tool area
187   */
188  toolWidth: number;
189
190  /**
191   * Height of the tool area
192   */
193  toolHeight: number;
194
195  /**
196   * X coordinate of the input device
197   */
198  rawX: number;
199
200  /**
201   * Y coordinate of the input device
202   */
203  rawY: number;
204
205  /**
206   * Tool type
207   */
208  toolType: ToolType;
209}
210
211/**
212 * TouchEvent
213 *
214 * @since 9
215 * @syscap SystemCapability.MultimodalInput.Input.Core
216 */
217export declare interface TouchEvent extends InputEvent {
218  /**
219   * Touch action
220   */
221  action: Action;
222
223  /**
224   * Current touch point
225   */
226  touch: Touch;
227
228  /**
229   * All touch points
230   */
231  touches: Touch[];
232
233  /**
234   * Device type of the touch source
235   */
236  sourceType: SourceType;
237}