• 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 */
15
16/**
17 * @file
18 * @kit InputKit
19 */
20
21import type { InputEvent } from './@ohos.multimodalInput.inputEvent';
22
23/**
24 * Action
25 *
26 * @enum { number }
27 * @syscap SystemCapability.MultimodalInput.Input.Core
28 * @since 9
29 */
30export declare enum Action {
31  /**
32   * Touch cancelled
33   *
34   * @syscap SystemCapability.MultimodalInput.Input.Core
35   * @since 9
36   */
37  CANCEL = 0,
38
39  /**
40   * Touch pressed
41   *
42   * @syscap SystemCapability.MultimodalInput.Input.Core
43   * @since 9
44   */
45  DOWN = 1,
46
47  /**
48   * Touch moved
49   *
50   * @syscap SystemCapability.MultimodalInput.Input.Core
51   * @since 9
52   */
53  MOVE = 2,
54
55  /**
56   * Touch lifted
57   *
58   * @syscap SystemCapability.MultimodalInput.Input.Core
59   * @since 9
60   */
61  UP = 3
62}
63
64/**
65 * ToolType
66 *
67 * @enum { number }
68 * @syscap SystemCapability.MultimodalInput.Input.Core
69 * @since 9
70 */
71export declare enum ToolType {
72  /**
73   * Finger
74   *
75   * @syscap SystemCapability.MultimodalInput.Input.Core
76   * @since 9
77   */
78  FINGER = 0,
79
80  /**
81   * Stylus
82   *
83   * @syscap SystemCapability.MultimodalInput.Input.Core
84   * @since 9
85   */
86  PEN = 1,
87
88  /**
89   * Rubber
90   *
91   * @syscap SystemCapability.MultimodalInput.Input.Core
92   * @since 9
93   */
94  RUBBER = 2,
95
96  /**
97   * Brush
98   *
99   * @syscap SystemCapability.MultimodalInput.Input.Core
100   * @since 9
101   */
102  BRUSH = 3,
103
104  /**
105   * Pencil
106   *
107   * @syscap SystemCapability.MultimodalInput.Input.Core
108   * @since 9
109   */
110  PENCIL = 4,
111
112  /**
113   * Air brush
114   *
115   * @syscap SystemCapability.MultimodalInput.Input.Core
116   * @since 9
117   */
118  AIRBRUSH = 5,
119
120  /**
121   * Mouse
122   *
123   * @syscap SystemCapability.MultimodalInput.Input.Core
124   * @since 9
125   */
126  MOUSE = 6,
127
128  /**
129   * lens
130   *
131   * @syscap SystemCapability.MultimodalInput.Input.Core
132   * @since 9
133   */
134  LENS = 7
135}
136
137/**
138 * SourceType
139 *
140 * @enum { number }
141 * @syscap SystemCapability.MultimodalInput.Input.Core
142 * @since 9
143 */
144export declare enum SourceType {
145  /**
146   * Touchscreen
147   *
148   * @syscap SystemCapability.MultimodalInput.Input.Core
149   * @since 9
150   */
151  TOUCH_SCREEN = 0,
152
153  /**
154   * Stylus
155   *
156   * @syscap SystemCapability.MultimodalInput.Input.Core
157   * @since 9
158   */
159  PEN = 1,
160
161  /**
162   * Touchpad
163   *
164   * @syscap SystemCapability.MultimodalInput.Input.Core
165   * @since 9
166   */
167  TOUCH_PAD = 2
168}
169
170/**
171 * Touch
172 *
173 * @interface Touch
174 * @syscap SystemCapability.MultimodalInput.Input.Core
175 * @since 9
176 */
177export declare interface Touch {
178  /**
179   * Pointer identifier
180   * @type { number }
181   * @syscap SystemCapability.MultimodalInput.Input.Core
182   * @since 9
183   */
184  id: number;
185
186  /**
187   * Time stamp when touch is pressed
188   * @type { number }
189   * @syscap SystemCapability.MultimodalInput.Input.Core
190   * @since 9
191   */
192  pressedTime: number;
193
194  /**
195   * X coordinate of the touch position on the screen
196   * @type { number }
197   * @syscap SystemCapability.MultimodalInput.Input.Core
198   * @since 9
199   */
200  screenX: number;
201
202  /**
203   * Y coordinate of the touch position on the screen
204   * @type { number }
205   * @syscap SystemCapability.MultimodalInput.Input.Core
206   * @since 9
207   */
208  screenY: number;
209
210  /**
211   * X coordinate of the touch position in the window
212   * @type { number }
213   * @syscap SystemCapability.MultimodalInput.Input.Core
214   * @since 9
215   */
216  windowX: number;
217
218  /**
219   * Y coordinate of the touch position in the window
220   * @type { number }
221   * @syscap SystemCapability.MultimodalInput.Input.Core
222   * @since 9
223   */
224  windowY: number;
225
226  /**
227   * Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates that the pressure is not supported.
228   * @type { number }
229   * @syscap SystemCapability.MultimodalInput.Input.Core
230   * @since 9
231   */
232  pressure: number;
233
234  /**
235   * Width of the contact area when touch is pressed
236   * @type { number }
237   * @syscap SystemCapability.MultimodalInput.Input.Core
238   * @since 9
239   */
240  width: number;
241
242  /**
243   * Height of the contact area when touch is pressed
244   * @type { number }
245   * @syscap SystemCapability.MultimodalInput.Input.Core
246   * @since 9
247   */
248  height: number;
249
250  /**
251   * Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt.
252   * @type { number }
253   * @syscap SystemCapability.MultimodalInput.Input.Core
254   * @since 9
255   */
256  tiltX: number;
257
258  /**
259   * Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt.
260   * @type { number }
261   * @syscap SystemCapability.MultimodalInput.Input.Core
262   * @since 9
263   */
264  tiltY: number;
265
266  /**
267   * Center point X of the tool area
268   * @type { number }
269   * @syscap SystemCapability.MultimodalInput.Input.Core
270   * @since 9
271   */
272  toolX: number;
273
274  /**
275   * Center point Y of the tool area
276   * @type { number }
277   * @syscap SystemCapability.MultimodalInput.Input.Core
278   * @since 9
279   */
280  toolY: number;
281
282  /**
283   * Width of the tool area
284   * @type { number }
285   * @syscap SystemCapability.MultimodalInput.Input.Core
286   * @since 9
287   */
288  toolWidth: number;
289
290  /**
291   * Height of the tool area
292   * @type { number }
293   * @syscap SystemCapability.MultimodalInput.Input.Core
294   * @since 9
295   */
296  toolHeight: number;
297
298  /**
299   * X coordinate of the input device
300   * @type { number }
301   * @syscap SystemCapability.MultimodalInput.Input.Core
302   * @since 9
303   */
304  rawX: number;
305
306  /**
307   * Y coordinate of the input device
308   * @type { number }
309   * @syscap SystemCapability.MultimodalInput.Input.Core
310   * @since 9
311   */
312  rawY: number;
313
314  /**
315   * Tool type
316   * @type { ToolType }
317   * @syscap SystemCapability.MultimodalInput.Input.Core
318   * @since 9
319   */
320  toolType: ToolType;
321}
322
323/**
324 * TouchEvent
325 *
326 * @extends InputEvent
327 * @interface TouchEvent
328 * @syscap SystemCapability.MultimodalInput.Input.Core
329 * @since 9
330 */
331export declare interface TouchEvent extends InputEvent {
332  /**
333   * Touch action
334   * @type { Action }
335   * @syscap SystemCapability.MultimodalInput.Input.Core
336   * @since 9
337   */
338  action: Action;
339
340  /**
341   * Current touch point
342   * @type { Touch }
343   * @syscap SystemCapability.MultimodalInput.Input.Core
344   * @since 9
345   */
346  touch: Touch;
347
348  /**
349   * All touch points
350   * @type { Touch[] }
351   * @syscap SystemCapability.MultimodalInput.Input.Core
352   * @since 9
353   */
354  touches: Touch[];
355
356  /**
357   * Device type of the touch source
358   * @type { SourceType }
359   * @syscap SystemCapability.MultimodalInput.Input.Core
360   * @since 9
361   */
362  sourceType: SourceType;
363}