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