1/* 2 * Copyright (c) 2022-2025 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 * Fixed mode of screenX and screenY. 172 * 173 * @enum { number } 174 * @syscap SystemCapability.MultimodalInput.Input.Core 175 * @systemapi Hide this for inner system use. 176 * @since 19 177 */ 178export declare enum FixedMode { 179 /** 180 * Not fix. 181 * 182 * @syscap SystemCapability.MultimodalInput.Input.Core 183 * @systemapi Hide this for inner system use. 184 * @since 19 185 */ 186 NONE = 0, 187 188 /** 189 * One hand mode. 190 * 191 * @syscap SystemCapability.MultimodalInput.Input.Core 192 * @systemapi Hide this for inner system use. 193 * @since 19 194 */ 195 AUTO = 1 196} 197 198/** 199 * Touch 200 * 201 * @interface Touch 202 * @syscap SystemCapability.MultimodalInput.Input.Core 203 * @since 9 204 */ 205export declare interface Touch { 206 /** 207 * Pointer identifier 208 * @type { number } 209 * @syscap SystemCapability.MultimodalInput.Input.Core 210 * @since 9 211 */ 212 id: number; 213 214 /** 215 * Time stamp when touch is pressed 216 * @type { number } 217 * @syscap SystemCapability.MultimodalInput.Input.Core 218 * @since 9 219 */ 220 pressedTime: number; 221 222 /** 223 * X coordinate of the touch position on the screen 224 * @type { number } 225 * @syscap SystemCapability.MultimodalInput.Input.Core 226 * @since 9 227 */ 228 screenX: number; 229 230 /** 231 * Y coordinate of the touch position on the screen 232 * @type { number } 233 * @syscap SystemCapability.MultimodalInput.Input.Core 234 * @since 9 235 */ 236 screenY: number; 237 238 /** 239 * X coordinate of the touch position in the window 240 * @type { number } 241 * @syscap SystemCapability.MultimodalInput.Input.Core 242 * @since 9 243 */ 244 windowX: number; 245 246 /** 247 * Y coordinate of the touch position in the window 248 * @type { number } 249 * @syscap SystemCapability.MultimodalInput.Input.Core 250 * @since 9 251 */ 252 windowY: number; 253 254 /** 255 * Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates that the pressure is not supported. 256 * @type { number } 257 * @syscap SystemCapability.MultimodalInput.Input.Core 258 * @since 9 259 */ 260 pressure: number; 261 262 /** 263 * Width of the contact area when touch is pressed 264 * @type { number } 265 * @syscap SystemCapability.MultimodalInput.Input.Core 266 * @since 9 267 */ 268 width: number; 269 270 /** 271 * Height of the contact area when touch is pressed 272 * @type { number } 273 * @syscap SystemCapability.MultimodalInput.Input.Core 274 * @since 9 275 */ 276 height: number; 277 278 /** 279 * Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt. 280 * @type { number } 281 * @syscap SystemCapability.MultimodalInput.Input.Core 282 * @since 9 283 */ 284 tiltX: number; 285 286 /** 287 * Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt. 288 * @type { number } 289 * @syscap SystemCapability.MultimodalInput.Input.Core 290 * @since 9 291 */ 292 tiltY: number; 293 294 /** 295 * Center point X of the tool area 296 * @type { number } 297 * @syscap SystemCapability.MultimodalInput.Input.Core 298 * @since 9 299 */ 300 toolX: number; 301 302 /** 303 * Center point Y of the tool area 304 * @type { number } 305 * @syscap SystemCapability.MultimodalInput.Input.Core 306 * @since 9 307 */ 308 toolY: number; 309 310 /** 311 * Width of the tool area 312 * @type { number } 313 * @syscap SystemCapability.MultimodalInput.Input.Core 314 * @since 9 315 */ 316 toolWidth: number; 317 318 /** 319 * Height of the tool area 320 * @type { number } 321 * @syscap SystemCapability.MultimodalInput.Input.Core 322 * @since 9 323 */ 324 toolHeight: number; 325 326 /** 327 * X coordinate of the input device 328 * @type { number } 329 * @syscap SystemCapability.MultimodalInput.Input.Core 330 * @since 9 331 */ 332 rawX: number; 333 334 /** 335 * Y coordinate of the input device 336 * @type { number } 337 * @syscap SystemCapability.MultimodalInput.Input.Core 338 * @since 9 339 */ 340 rawY: number; 341 342 /** 343 * Tool type 344 * @type { ToolType } 345 * @syscap SystemCapability.MultimodalInput.Input.Core 346 * @since 9 347 */ 348 toolType: ToolType; 349 350 /** 351 * fixedDisplayX - Corrected value of the screen x coordinate. 352 * @type { number } 353 * @syscap SystemCapability.MultimodalInput.Input.Core 354 * @systemapi Hide this for inner system use. 355 * @since 19 356 */ 357 fixedDisplayX?: number; 358 359 /** 360 * fixedDisplayY - Corrected value of the screen y coordinate. 361 * @type { number } 362 * @syscap SystemCapability.MultimodalInput.Input.Core 363 * @systemapi Hide this for inner system use. 364 * @since 19 365 */ 366 fixedDisplayY?: number; 367 368 /** 369 * globalX - Global X coordinate. 370 * @type { ?number } 371 * @syscap SystemCapability.MultimodalInput.Input.Core 372 * @since 20 373 * @arkts 1.1&1.2 374 */ 375 globalX?: number; 376 377 /** 378 * globalY - Global Y coordinate. 379 * @type { ?number } 380 * @syscap SystemCapability.MultimodalInput.Input.Core 381 * @since 20 382 * @arkts 1.1&1.2 383 */ 384 globalY?: number; 385} 386 387/** 388 * TouchEvent 389 * 390 * @extends InputEvent 391 * @interface TouchEvent 392 * @syscap SystemCapability.MultimodalInput.Input.Core 393 * @since 9 394 */ 395export declare interface TouchEvent extends InputEvent { 396 /** 397 * Touch action 398 * @type { Action } 399 * @syscap SystemCapability.MultimodalInput.Input.Core 400 * @since 9 401 */ 402 action: Action; 403 404 /** 405 * Current touch point 406 * @type { Touch } 407 * @syscap SystemCapability.MultimodalInput.Input.Core 408 * @since 9 409 */ 410 touch: Touch; 411 412 /** 413 * All touch points 414 * @type { Touch[] } 415 * @syscap SystemCapability.MultimodalInput.Input.Core 416 * @since 9 417 */ 418 touches: Touch[]; 419 420 /** 421 * Device type of the touch source 422 * @type { SourceType } 423 * @syscap SystemCapability.MultimodalInput.Input.Core 424 * @since 9 425 */ 426 sourceType: SourceType; 427 428 /** 429 * fixedMode - Fixed mode of Touch. 430 * 431 * @type { FixedMode } 432 * @syscap SystemCapability.MultimodalInput.Input.Core 433 * @systemapi Hide this for inner system use. 434 * @since 19 435 */ 436 fixedMode?: FixedMode; 437 438 /** 439 * Indicates whether the touch event is an inject event. 440 * @type { ?boolean } 441 * @syscap SystemCapability.MultimodalInput.Input.Core 442 * @systemapi Hide this for inner system use. 443 * @since 20 444 */ 445 isInject?: boolean; 446}