js-apis-pointer.md 65.9 KB
Newer Older
1
# @ohos.multimodalInput.pointer (鼠标指针)
L
liuwei 已提交
2

M
mayunteng_1 已提交
3
鼠标指针管理模块,用于查询和设置鼠标指针相关属性。
L
liuwei 已提交
4 5 6 7 8 9 10 11 12 13 14

> **说明**:
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

## 导入模块

```js
import pointer from '@ohos.multimodalInput.pointer';
```

M
mayunteng_1 已提交
15
## pointer.setPointerVisible<sup>9+</sup>
L
liuwei 已提交
16

L
liuwei 已提交
17
setPointerVisible(visible: boolean, callback: AsyncCallback&lt;void&gt;): void
L
liuwei 已提交
18

M
mayunteng_1 已提交
19
设置鼠标指针显示或者隐藏,使用AsyncCallback异步方式返回结果。
L
liuwei 已提交
20 21 22 23 24

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**参数**

M
mayunteng_1 已提交
25
| 参数名       | 类型                        | 必填   | 说明                                       |
H
HelloCrease 已提交
26
| -------- | ------------------------- | ---- | ---------------------------------------- |
M
mayunteng_1 已提交
27
| visible  | boolean                   | 是    | 鼠标指针是否显示。 |
M
mayunteng_1 已提交
28
| callback | AsyncCallback&lt;void&gt; | 是    | 回调函数。 |
L
liuwei 已提交
29 30 31 32

**示例**

```js
M
mayunteng_1 已提交
33
try {
M
mayunteng_1 已提交
34 35 36 37 38
  pointer.setPointerVisible(true, (error) => {
    if (error) {
      console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
M
mayunteng_1 已提交
39 40
    console.log(`Set pointer visible success`);
  });
M
mayunteng_1 已提交
41 42
} catch (error) {
  console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
M
mayunteng_1 已提交
43
}
L
liuwei 已提交
44 45
```

M
mayunteng_1 已提交
46
## pointer.setPointerVisible<sup>9+</sup>
L
liuwei 已提交
47

L
liuwei 已提交
48
setPointerVisible(visible: boolean): Promise&lt;void&gt;
L
liuwei 已提交
49

M
mayunteng_1 已提交
50
设置鼠标指针显示或者隐藏,使用Promise异步方式返回结果。
L
liuwei 已提交
51 52 53 54 55

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**参数**

M
mayunteng_1 已提交
56
| 参数名      | 类型      | 必填   | 说明                                       |
H
HelloCrease 已提交
57
| ------- | ------- | ---- | ---------------------------------------- |
M
mayunteng_1 已提交
58
| visible | boolean | 是    | 鼠标指针是否显示。 |
L
liuwei 已提交
59 60 61

**返回值**

H
HelloCrease 已提交
62 63
| 参数                  | 说明                  |
| ------------------- | ------------------- |
M
mayunteng_1 已提交
64
| Promise&lt;void&gt; | Promise对象。 |
L
liuwei 已提交
65 66 67 68

**示例**

```js
M
mayunteng_1 已提交
69
try {
M
mayunteng_1 已提交
70 71
  pointer.setPointerVisible(false).then(() => {
    console.log(`Set pointer visible success`);
M
mayunteng_1 已提交
72
  });
M
mayunteng_1 已提交
73 74
} catch (error) {
  console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
M
mayunteng_1 已提交
75
}
L
liuwei 已提交
76 77
```

M
mayunteng_1 已提交
78
## pointer.isPointerVisible<sup>9+</sup>
L
liuwei 已提交
79

L
liuwei 已提交
80
isPointerVisible(callback: AsyncCallback&lt;boolean&gt;): void
L
liuwei 已提交
81

M
mayunteng_1 已提交
82
获取鼠标指针显示或隐藏状态,使用AsyncCallback异步方式返回结果。
L
liuwei 已提交
83 84 85 86 87

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**参数**

M
mayunteng_1 已提交
88
| 参数名       | 类型                           | 必填   | 说明             |
H
HelloCrease 已提交
89
| -------- | ---------------------------- | ---- | -------------- |
M
mayunteng_1 已提交
90
| callback | AsyncCallback&lt;boolean&gt; | 是    | 回调函数,异步返回鼠标指针显示或隐藏状态。 |
L
liuwei 已提交
91 92 93 94

**示例**

```js
M
mayunteng_1 已提交
95
try {
M
mayunteng_1 已提交
96 97 98 99 100 101
  pointer.isPointerVisible((error, visible) => {
    if (error) {
      console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`);
M
mayunteng_1 已提交
102
  });
M
mayunteng_1 已提交
103 104
} catch (error) {
  console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
M
mayunteng_1 已提交
105
}
L
liuwei 已提交
106 107
```

M
mayunteng_1 已提交
108
## pointer.isPointerVisible<sup>9+</sup>
L
liuwei 已提交
109 110 111

isPointerVisible(): Promise&lt;boolean&gt;

M
mayunteng_1 已提交
112
获取鼠标指针显示或隐藏状态,使用Promise异步方式返回结果。
L
liuwei 已提交
113 114 115 116 117

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**返回值**

H
HelloCrease 已提交
118 119
| 参数                     | 说明                  |
| ---------------------- | ------------------- |
M
mayunteng_1 已提交
120
| Promise&lt;boolean&gt; | Promise对象,异步返回鼠标指针显示或隐藏状态。 |
L
liuwei 已提交
121 122 123 124

**示例**

```js
M
mayunteng_1 已提交
125 126 127 128 129 130 131
try {
  pointer.isPointerVisible().then((visible) => {
    console.log(`Get pointer visible success, visible: ${JSON.stringify(visible)}`);
  });
} catch (error) {
  console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
L
liuwei 已提交
132
```
133 134 135

## pointer.setPointerSpeed<sup>9+</sup>

M
mayunteng_1 已提交
136
setPointerSpeed(speed: number, callback: AsyncCallback&lt;void&gt;): void
137

M
mayunteng_1 已提交
138
设置鼠标移动速度,使用AsyncCallback异步方式返回结果。
139 140 141

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

M
mayunteng_1 已提交
142 143
**系统API**: 此接口为系统接口。

144 145
**参数**

M
mayunteng_1 已提交
146
| 参数名       | 类型                        | 必填   | 说明                                    |
H
HelloCrease 已提交
147
| -------- | ------------------------- | ---- | ------------------------------------- |
M
mayunteng_1 已提交
148
| speed    | number                    | 是    | 鼠标移动速度,范围1-11,默认为5。   |
M
mayunteng_1 已提交
149
| callback | AsyncCallback&lt;void&gt; | 是    | 回调函数。 |
150 151 152 153

**示例**

```js
M
mayunteng_1 已提交
154
try {
M
mayunteng_1 已提交
155 156 157 158 159
  pointer.setPointerSpeed(5, (error) => {
    if (error) {
      console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
M
mayunteng_1 已提交
160 161
    console.log(`Set pointer speed success`);
  });
M
mayunteng_1 已提交
162
} catch (error) {
M
mayunteng_1 已提交
163
  console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
M
mayunteng_1 已提交
164
}
165 166 167 168 169 170
```

## pointer.setPointerSpeed<sup>9+</sup>

setPointerSpeed(speed: number): Promise&lt;void&gt;

M
mayunteng_1 已提交
171
设置鼠标移动速度,使用Promise异步方式返回结果。
172 173 174

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

M
mayunteng_1 已提交
175 176
**系统API**: 此接口为系统接口。

177 178
**参数**

M
mayunteng_1 已提交
179
| 参数名    | 类型     | 必填   | 说明                                  |
H
HelloCrease 已提交
180
| ----- | ------ | ---- | ----------------------------------- |
M
mayunteng_1 已提交
181
| speed | number | 是    | 鼠标移动速度,范围1-11,默认为5。 |
182 183 184

**返回值**

H
HelloCrease 已提交
185 186
| 参数                  | 说明               |
| ------------------- | ---------------- |
M
mayunteng_1 已提交
187
| Promise&lt;void&gt; | Promise对象。 |
188 189 190 191

**示例**

```js
M
mayunteng_1 已提交
192
try {
M
mayunteng_1 已提交
193
  pointer.setPointerSpeed(5).then(() => {
M
mayunteng_1 已提交
194 195
    console.log(`Set pointer speed success`);
  });
M
mayunteng_1 已提交
196 197
} catch (error) {
  console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
M
mayunteng_1 已提交
198
}
199 200 201 202 203 204
```

## pointer.getPointerSpeed<sup>9+</sup>

getPointerSpeed(callback: AsyncCallback&lt;number&gt;): void

M
mayunteng_1 已提交
205
获取鼠标移动速度,使用AsyncCallback异步方式返回结果。
206 207 208

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

M
mayunteng_1 已提交
209 210
**系统API**: 此接口为系统接口。

211 212
**参数**

M
mayunteng_1 已提交
213
| 参数名       | 类型                          | 必填   | 说明             |
H
HelloCrease 已提交
214
| -------- | --------------------------- | ---- | -------------- |
M
mayunteng_1 已提交
215
| callback | AsyncCallback&lt;number&gt; | 是    | 回调函数,异步返回鼠标移动速度。 |
216 217 218 219

**示例**

```js
M
mayunteng_1 已提交
220
try {
M
mayunteng_1 已提交
221
  pointer.getPointerSpeed((error, speed) => {
M
mayunteng_1 已提交
222 223 224 225 226
    if (error) {
      console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`);
M
mayunteng_1 已提交
227
  });
M
mayunteng_1 已提交
228
} catch (error) {
M
mayunteng_1 已提交
229
  console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
M
mayunteng_1 已提交
230
}
231 232 233 234 235 236
```

## pointer.getPointerSpeed<sup>9+</sup>

getPointerSpeed(): Promise&lt;number&gt;

M
mayunteng_1 已提交
237
获取当前鼠标移动速度,使用Promise异步方式返回结果。
238 239 240

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

M
mayunteng_1 已提交
241 242
**系统API**: 此接口为系统接口。

243 244
**返回值**

H
HelloCrease 已提交
245 246
| 参数                    | 说明                  |
| --------------------- | ------------------- |
M
mayunteng_1 已提交
247
| Promise&lt;number&gt; | Promise实例,异步返回鼠标移动速度。 |
248 249 250 251

**示例**

```js
M
mayunteng_1 已提交
252
try {
M
mayunteng_1 已提交
253 254
  pointer.getPointerSpeed().then(speed => {
    console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`);
M
mayunteng_1 已提交
255
  });
M
mayunteng_1 已提交
256 257
} catch (error) {
  console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
M
mayunteng_1 已提交
258
}
259 260
```

X
xixian_2023 已提交
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397
## pointer.setHoverScrollState<sup>10+</sup>

setHoverScrollState(state: boolean, callback: AsyncCallback&lt;void&gt;): void

设置鼠标悬停滚动开关状态,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state    | boolean                    | 是    | 鼠标悬停滚动开关状态。   |
| callback | AsyncCallback&lt;void&gt; | 是    | 回调函数。 |

**示例**

```js
try {
  pointer.setHoverScrollState(true, (error) => {
    if (error) {
      console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Set the mouse hover scroll success`);
  });
} catch (error) {
  console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setHoverScrollState<sup>10+</sup>

setHoverScrollState(state: boolean): Promise&lt;void&gt;

设置鼠标悬停滚动开关状态,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean | 是    | 鼠标悬停滚动开关状态。 |

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise对象。 |

**示例**

```js
try {
  pointer.setHoverScrollState(true).then(() => {
    console.log(`Set the mouse hover scroll success`);
  });
} catch (error) {
  console.log(`Set the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getHoverScrollState<sup>10+</sup>

getHoverScrollState(callback: AsyncCallback&lt;boolean&gt;): void

获取鼠标悬停滚动开关状态,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback&lt;boolean&gt; | 是    | 回调函数,异步返回鼠标悬停滚动开关状态。 |

**示例**

```js
try {
  pointer.getHoverScrollState((error, state) => {
    console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getHoverScrollState<sup>10+</sup>

getHoverScrollState(): Promise&lt;boolean&gt;

获取当前鼠标悬停滚动开关状态,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| Promise&lt;boolean&gt; | Promise实例,异步返回鼠标悬停滚动开关状态。 |

**示例**

```js
try {
  pointer.getHoverScrollState().then((state) => {
    console.log(`Get the mouse hover scroll success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`Get the mouse hover scroll failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setMousePrimaryButton<sup>10+</sup>

setMousePrimaryButton(primary: PrimaryButton, callback: AsyncCallback&lt;void&gt;): void

设置鼠标主键,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型                      | 必填  | 说明                                    |
| -------- | ------------------------- | ----  | ------------------------------------- |
398
| primary  | [PrimaryButton](#primarybutton10)   | 是    | 鼠标主键id。   |
X
xixian_2023 已提交
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
| callback | AsyncCallback&lt;void&gt; | 是    | 回调函数。 |

**示例**

```js
try {
  pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT, (error) => {
    if (error) {
      console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`Set mouse primary button success`);
  });
} catch (error) {
  console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setMousePrimaryButton<sup>10+</sup>

setMousePrimaryButton(primary: PrimaryButton): Promise&lt;void&gt;

设置鼠标主键,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
431
| primary | [PrimaryButton](#primarybutton10) | 是    | 鼠标主键id。 |
X
xixian_2023 已提交
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise对象。 |

**示例**

```js
try {
  pointer.setMousePrimaryButton(pointer.PrimaryButton.RIGHT).then(() => {
    console.log(`Set mouse primary button success`);
  });
} catch (error) {
  console.log(`Set mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getMousePrimaryButton<sup>10+</sup>

getMousePrimaryButton(callback: AsyncCallback&lt;PrimaryButton&gt;): void

获取鼠标主键,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
465
| callback | AsyncCallback&lt;[PrimaryButton](#primarybutton10)&gt; | 是    | 回调函数,异步返回鼠标主键。 |
X
xixian_2023 已提交
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492

**示例**

```js
try {
  pointer.getMousePrimaryButton((error, primary) => {
    console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`);
  });
} catch (error) {
  console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getMousePrimaryButton<sup>10+</sup>

getMousePrimaryButton(): Promise&lt;PrimaryButton&gt;

获取当前鼠标主键,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
493
| Promise&lt;[PrimaryButton](#primarybutton10)&gt; | Promise实例,异步返回鼠标主键。 |
X
xixian_2023 已提交
494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552

**示例**

```js
try {
  pointer.getMousePrimaryButton().then((primary) => {
    console.log(`Get mouse primary button success, primary: ${JSON.stringify(primary)}`);
  });
} catch (error) {
  console.log(`Get mouse primary button failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## PrimaryButton<sup>10+</sup>

鼠标主键类型。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

| 名称                               | 值    | 说明     |
| -------------------------------- | ---- | ------ |
| LEFT                          | 0    | 鼠标左键     |
| RIGHT                             | 1    | 鼠标右键   |

## pointer.setMouseScrollRows<sup>10+</sup>

setMouseScrollRows(rows: number, callback: AsyncCallback&lt;void&gt;): void

设置鼠标滚动行数,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
| rows     | number                    | 是    | 鼠标滚动行数,范围1-100,默认为3。   |
| callback | AsyncCallback&lt;void&gt; | 是    | 回调函数。 |

**示例**

```js
try {
  pointer.setMouseScrollRows(1, (error) => {
    if (error) {
      console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setMouseScrollRows success`);
  });
} catch (error) {
  console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setMouseScrollRows<sup>10+</sup>

553
setMouseScrollRows(rows: number): Promise&lt;void&gt;
X
xixian_2023 已提交
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640

设置鼠标滚动行数,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| rows  | number | 是    | 鼠标滚动行数,范围1-100,默认为3。 |

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | Promise对象。 |

**示例**

```js
try {
  pointer.setMouseScrollRows(20).then(() => {
    console.log(`setMouseScrollRows success`);
  });
} catch (error) {
  console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getMouseScrollRows<sup>10+</sup>

getMouseScrollRows(callback: AsyncCallback&lt;number&gt;): void

获取鼠标滚动行数,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback&lt;number&gt; | 是    | 回调函数,异步返回鼠标滚动行数。 |

**示例**

```js
try {
  pointer.getMouseScrollRows((error, rows) => {
    console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`);
  });
} catch (error) {
  console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getMouseScrollRows<sup>10+</sup>

getMouseScrollRows(): Promise&lt;number&gt;

获取当前鼠标滚动行数,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| Promise&lt;number&gt; | Promise实例,异步返回鼠标滚动行数。 |

**示例**

```js
try {
  pointer.getMouseScrollRows().then((rows) => {
    console.log(`getMouseScrollRows success, rows: ${JSON.stringify(rows)}`);
  });
} catch (error) {
  console.log(`getMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

641 642
## pointer.getPointerStyle<sup>9+</sup>

643
getPointerStyle(windowId: number, callback: AsyncCallback&lt;PointerStyle&gt;): void
644

M
mayunteng_1 已提交
645
获取鼠标样式类型,使用AsyncCallback异步方式返回结果。
646 647 648 649 650

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**参数**

M
mayunteng_1 已提交
651
| 参数名       | 类型                                       | 必填   | 说明             |
H
HelloCrease 已提交
652
| -------- | ---------------------------------------- | ---- | -------------- |
M
mayunteng_1 已提交
653 654
| windowId | number                                   | 是    | 窗口id。    |
| callback | AsyncCallback&lt;[PointerStyle](#pointerstyle9)&gt; | 是    | 回调函数,异步返回鼠标样式类型。 |
655 656 657 658

**示例**

```js
659
import window from '@ohos.window';
M
mayunteng_1 已提交
660

661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
window.getLastWindow(this.context, (error, win) => {
  if (error.code) {
    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
    return;
  }
  let windowId = win.getWindowProperties().id;
  if (windowId < 0) {
    console.log(`Invalid windowId`);
    return;
  }
  try {
    pointer.getPointerStyle(windowId, (error, style) => {
      console.log(`Get pointer style success, style: ${JSON.stringify(style)}`);
    });
  } catch (error) {
    console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
  }
678 679 680 681 682
});
```

## pointer.getPointerStyle<sup>9+</sup>

683
getPointerStyle(windowId: number): Promise&lt;PointerStyle&gt;
684

M
mayunteng_1 已提交
685
获取鼠标样式类型,使用Promise异步方式返回结果。
686 687 688 689 690

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**参数**

M
mayunteng_1 已提交
691
| 参数名     | 类型   | 必填 | 说明     |
M
mayunteng_1 已提交
692 693 694 695 696
| -------- | ------ | ---- | -------- |
| windowId | number | 是   | 窗口id。 |

**返回值**

H
HelloCrease 已提交
697 698
| 参数                                       | 说明                  |
| ---------------------------------------- | ------------------- |
M
mayunteng_1 已提交
699
| Promise&lt;[PointerStyle](#pointerstyle9)&gt; | Promise实例,异步返回鼠标样式类型。 |
700 701 702 703

**示例**

```js
704
import window from '@ohos.window';
M
mayunteng_1 已提交
705

706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
window.getLastWindow(this.context, (error, win) => {
  if (error.code) {
    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
    return;
  }
  let windowId = win.getWindowProperties().id;
  if (windowId < 0) {
    console.log(`Invalid windowId`);
    return;
  }
  try {
    pointer.getPointerStyle(windowId).then((style) => {
      console.log(`Get pointer style success, style: ${JSON.stringify(style)}`);
    });
  } catch (error) {
    console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
  }
723 724 725 726 727
});
```

## pointer.setPointerStyle<sup>9+</sup>

728
setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback&lt;void&gt;): void
729

M
mayunteng_1 已提交
730
设置鼠标样式类型,使用AsyncCallback异步方式返回结果。
731 732 733 734 735

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**参数**

M
mayunteng_1 已提交
736
| 参数名           | 类型                             | 必填   | 说明                                  |
H
HelloCrease 已提交
737
| ------------ | ------------------------------ | ---- | ----------------------------------- |
M
mayunteng_1 已提交
738
| windowId     | number                         | 是    | 窗口id。                          |
H
HelloCrease 已提交
739
| pointerStyle | [PointerStyle](#pointerstyle9) | 是    | 鼠标样式id。                             |
M
mayunteng_1 已提交
740
| callback     | AsyncCallback&lt;void&gt;      | 是    | 回调函数。 |
741 742 743 744

**示例**

```js
745
import window from '@ohos.window';
M
mayunteng_1 已提交
746

747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763
window.getLastWindow(this.context, (error, win) => {
  if (error.code) {
    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
    return;
  }
  let windowId = win.getWindowProperties().id;
  if (windowId < 0) {
    console.log(`Invalid windowId`);
    return;
  }
  try {
    pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => {
      console.log(`Set pointer style success`);
    });
  } catch (error) {
    console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
  }
764 765 766 767
});
```
## pointer.setPointerStyle<sup>9+</sup>

768
setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise&lt;void&gt;
769

M
mayunteng_1 已提交
770
设置鼠标样式类型,使用Promise异步方式返回结果。
771 772 773 774 775

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**参数**

M
mayunteng_1 已提交
776
| 参数名                  | 类型                             | 必填   | 说明               |
H
HelloCrease 已提交
777
| ------------------- | ------------------------------ | ---- | ---------------- |
M
mayunteng_1 已提交
778
| windowId            | number                         | 是    | 窗口id。       |
H
HelloCrease 已提交
779
| pointerStyle        | [PointerStyle](#pointerstyle9) | 是    | 鼠标样式id。          |
M
mayunteng_1 已提交
780
| Promise&lt;void&gt; | void                           | 是    | Promise对象。 |
781 782 783 784

**示例**

```js
785
import window from '@ohos.window';
M
mayunteng_1 已提交
786

787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
window.getLastWindow(this.context, (error, win) => {
  if (error.code) {
    console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
    return;
  }
  let windowId = win.getWindowProperties().id;
  if (windowId < 0) {
    console.log(`Invalid windowId`);
    return;
  }
  try {
    pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => {
      console.log(`Set pointer style success`);
    });
  } catch (error) {
    console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
  }
804 805 806 807
});
```
## PointerStyle<sup>9+</sup>

M
mayunteng_1 已提交
808
鼠标样式类型。
809 810 811

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851
| 名称                               | 值    | 说明     |图示 |
| -------------------------------- | ---- | ------ |------ |
| DEFAULT                          | 0    | 默认     |![Default.png](./figures/Default.png)|
| EAST                             | 1    | 向东箭头   |![East.png](./figures/East.png)|
| WEST                             | 2    | 向西箭头   |![West.png](./figures/West.png)|
| SOUTH                            | 3    | 向南箭头   |![South.png](./figures/South.png)|
| NORTH                            | 4    | 向北箭头   |![North.png](./figures/North.png)|
| WEST_EAST                        | 5    | 向西东箭头  |![West_East.png](./figures/West_East.png)|
| NORTH_SOUTH                      | 6    | 向北南箭头  |![North_South.png](./figures/North_South.png)|
| NORTH_EAST                       | 7    | 向东北箭头  |![North_East.png](./figures/North_East.png)|
| NORTH_WEST                       | 8    | 向西北箭头  |![North_West.png](./figures/North_West.png)|
| SOUTH_EAST                       | 9    | 向东南箭头  |![South_East.png](./figures/South_East.png)|
| SOUTH_WEST                       | 10   | 向西南箭头  |![South_West.png](./figures/South_West.png)|
| NORTH_EAST_SOUTH_WEST            | 11   | 东北西南调整 |![North_East_South_West.png](./figures/North_East_South_West.png)|
| NORTH_WEST_SOUTH_EAST            | 12   | 西北东南调整 |![North_West_South_East.png](./figures/North_West_South_East.png)|
| CROSS                            | 13   | 准确选择   |![Cross.png](./figures/Cross.png)|
| CURSOR_COPY                      | 14   | 拷贝     |![Copy.png](./figures/Copy.png)|
| CURSOR_FORBID                    | 15   | 不可用    |![Forbid.png](./figures/Forbid.png)|
| COLOR_SUCKER                     | 16   | 滴管     |![Colorsucker.png](./figures/Colorsucker.png)|
| HAND_GRABBING                    | 17   | 并拢的手   |![Hand_Grabbing.png](./figures/Hand_Grabbing.png)|
| HAND_OPEN                        | 18   | 张开的手   |![Hand_Open.png](./figures/Hand_Open.png)|
| HAND_POINTING                    | 19   | 手形指针   |![Hand_Poniting.png](./figures/Hand_Pointing.png)|
| HELP                             | 20   | 帮助选择   |![Help.png](./figures/Help.png)|
| MOVE                             | 21   | 移动     |![Move.png](./figures/Move.png)|
| RESIZE_LEFT_RIGHT                | 22   | 内部左右调整 |![Resize_Left_Right.png](./figures/Resize_Left_Right.png)|
| RESIZE_UP_DOWN                   | 23   | 内部上下调整 |![Resize_Up_Down.png](./figures/Resize_Up_Down.png)|
| SCREENSHOT_CHOOSE                | 24   | 截图十字准星 |![Screenshot_Cross.png](./figures/Screenshot_Cross.png)|
| SCREENSHOT_CURSOR                | 25   | 截图     |![Screenshot_Cursor.png](./figures/Screenshot_Cursor.png)|
| TEXT_CURSOR                      | 26   | 文本选择   |![Text_Cursor.png](./figures/Text_Cursor.png)|
| ZOOM_IN                          | 27   | 放大     |![Zoom_In.png](./figures/Zoom_In.png)|
| ZOOM_OUT                         | 28   | 缩小     |![Zoom_Out.png](./figures/Zoom_Out.png)|
| MIDDLE_BTN_EAST                  | 29   | 向东滚动   |![MID_Btn_East.png](./figures/MID_Btn_East.png)|
| MIDDLE_BTN_WEST                  | 30   | 向西滚动   |![MID_Btn_West.png](./figures/MID_Btn_West.png)|
| MIDDLE_BTN_SOUTH                 | 31   | 向南滚动   | ![MID_Btn_South.png](./figures/MID_Btn_South.png)            |
| MIDDLE_BTN_NORTH                 | 32   | 向北滚动   |![MID_Btn_North.png](./figures/MID_Btn_North.png)|
| MIDDLE_BTN_NORTH_SOUTH           | 33   | 向北南滚动  |![MID_Btn_North_South.png](./figures/MID_Btn_North_South.png)|
| MIDDLE_BTN_NORTH_EAST            | 34   | 向东北滚动  |![MID_Btn_North_East.png](./figures/MID_Btn_North_East.png)|
| MIDDLE_BTN_NORTH_WEST            | 35   | 向西北滚动  |![MID_Btn_North_West.png](./figures/MID_Btn_North_West.png)|
| MIDDLE_BTN_SOUTH_EAST            | 36   | 向东南滚动  |![MID_Btn_South_East.png](./figures/MID_Btn_South_East.png)|
| MIDDLE_BTN_SOUTH_WEST            | 37   | 向西南滚动  |![MID_Btn_South_West.png](./figures/MID_Btn_South_West.png)|
G
gaoshangqi 已提交
852
| MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38   | 四向锥形移动 |![MID_Btn_North_South_West_East.png](./figures/MID_Btn_North_South_West_East.png)|
M
mengwei 已提交
853 854 855
| HORIZONTAL_TEXT_CURSOR<sup>10+</sup> | 39 | 垂直文本选择 |![Horizontal_Text_Cursor.png](./figures/Horizontal_Text_Cursor.png)|
| CURSOR_CROSS<sup>10+</sup> | 40 | 十字光标 |![Cursor_Cross.png](./figures/Cursor_Cross.png)|
| CURSOR_CIRCLE<sup>10+</sup> | 41 | 圆形光标 |![Cursor_Circle.png](./figures/Cursor_Circle.png)|
X
xixian_2023 已提交
856

857
## pointer.setTouchpadScrollSwitch<sup>10+</sup>
X
xixian_2023 已提交
858

859
setTouchpadScrollSwitch(state: boolean, callback: AsyncCallback\<void>): void
X
xixian_2023 已提交
860

861
设置触控板滚轴开关,使用AsyncCallback异步方式返回结果。
X
xixian_2023 已提交
862 863 864 865 866 867 868 869 870

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
871 872
| state | boolean | 是    | 滚轴开关开启的状态,true代表开启,false代表关闭,默认为开启   |
| callback | AsyncCallback\<void> | 是    | 回调函数。 |
X
xixian_2023 已提交
873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891

**示例**

```js
try {
  pointer.setTouchpadScrollSwitch(true, (error) => {
    if (error) {
      console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setTouchpadScrollSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadScrollSwitch<sup>10+</sup>

892
setTouchpadScrollSwitch(state: boolean): Promise\<void>
X
xixian_2023 已提交
893

894
设置触控板滚轴开关,使用Promise异步方式返回结果。
X
xixian_2023 已提交
895 896 897 898 899 900 901 902 903

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
904
| state | boolean| 是    |  滚轴开关开启的状态,true代表开启,false代表关闭,默认为开启 |
X
xixian_2023 已提交
905 906 907 908 909

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
910
| Promise\<void> | Promise对象。 |
X
xixian_2023 已提交
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925

**示例**

```js
try {
  pointer.setTouchpadScrollSwitch(false).then(() => {
    console.log(`setTouchpadScrollSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadScrollSwitch<sup>10+</sup>

926
getTouchpadScrollSwitch(callback:  AsyncCallback\<boolean>): void
X
xixian_2023 已提交
927 928 929 930 931 932 933 934 935 936 937

获取触控板滚轴能力开启状态,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
938
| callback | AsyncCallback\<boolean> | 是    | 回调函数,异步返回触控板滚轴能力开启状态。 |
X
xixian_2023 已提交
939 940 941 942 943 944 945 946 947 948 949 950 951 952 953

**示例**

```js
try {
  pointer.getTouchpadScrollSwitch ((error, state) => {
    console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadScrollSwitch<sup>10+</sup>

954
getTouchpadScrollSwitch(): Promise\<boolean>
X
xixian_2023 已提交
955 956 957 958 959 960 961 962 963 964 965

获取触控板滚轴能力开启状态,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
966
| Promise\<boolean> | Promise实例,异步返回触控板滚轴能力开启状态。 |
X
xixian_2023 已提交
967 968 969 970 971 972 973 974 975 976 977 978 979 980 981

**示例**

```js
try {
  pointer.getTouchpadScrollSwitch().then((state) => {
    console.log(`getTouchpadScrollSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadScrollDirection<sup>10+</sup>

982
setTouchpadScrollDirection(state: boolean, callback: AsyncCallback\<void>): void
X
xixian_2023 已提交
983 984 985 986 987 988 989 990 991 992 993

设置触控板滚轴的方向,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
994 995
| state | boolean | 是    | state为触控板滚轴的方向。true与手指滑动的方向一致,false与手指滑动的方向相反,默认为true。   |
| callback | AsyncCallback\<void> | 是    | 回调函数。 |
X
xixian_2023 已提交
996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014

**示例**

```js
try {
  pointer.setTouchpadScrollDirection(true, (error) => {
    if (error) {
      console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setTouchpadScrollDirection success`);
  });
} catch (error) {
  console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadScrollDirection<sup>10+</sup>

1015
setTouchpadScrollDirection(state: boolean): Promise\<void>
X
xixian_2023 已提交
1016

1017
设置触控板滚轴的方向,使用Promise异步方式返回结果。
X
xixian_2023 已提交
1018 1019 1020 1021 1022 1023 1024 1025 1026

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
1027
| state | boolean| 是    |  state为触控板滚轴的方向。true与手指滑动的方向一致,false与手指滑动的方向相反,默认为true。     |
X
xixian_2023 已提交
1028 1029 1030 1031 1032

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
1033
| Promise\<void> | Promise对象。 |
X
xixian_2023 已提交
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048

**示例**

```js
try {
  pointer.setTouchpadScrollDirection (false).then(() => {
    console.log(`setTouchpadScrollDirection success`);
  });
} catch (error) {
  console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadScrollDirection<sup>10+</sup>

1049
getTouchpadScrollDirection(callback:  AsyncCallback\<boolean>): void
X
xixian_2023 已提交
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060

获取触控板滚轴方向,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
1061
| callback | AsyncCallback\<boolean> | 是    | 回调函数,异步返回触控板滚轴方向。 |
X
xixian_2023 已提交
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076

**示例**

```js
try {
  pointer.getTouchpadScrollSwitch ((error, state) => {
    console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadScrollDirection<sup>10+</sup>

1077
getTouchpadScrollDirection(): Promise\<boolean>
X
xixian_2023 已提交
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088

获取触控板滚轴方向,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
1089
| Promise\<boolean> | Promise实例,异步返回触控板滚轴方向。 |
X
xixian_2023 已提交
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104

**示例**

```js
try {
  pointer.getTouchpadScrollDirection().then((state) => {
    console.log(`getTouchpadScrollDirection success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadTapSwitch<sup>10+</sup>

1105
setTouchpadTapSwitch(state: boolean, callback: AsyncCallback\<void>): void
X
xixian_2023 已提交
1106

1107
设置触控板轻触功能开关,使用AsyncCallback异步方式返回结果。
X
xixian_2023 已提交
1108 1109 1110 1111 1112 1113 1114 1115 1116

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
1117 1118
| state | boolean | 是    |触控板轻触功能开关开启状态。 true代表轻触开启,false代表轻触关闭,默认开启。   |
| callback | AsyncCallback\<void> | 是    | 回调函数。 |
X
xixian_2023 已提交
1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137

**示例**

```js
try {
  pointer.setTouchpadTapSwitch(true, (error) => {
    if (error) {
      console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setTouchpadTapSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadTapSwitch <sup>10+</sup>

1138
setTouchpadTapSwitch(state: boolean): Promise\<void>
X
xixian_2023 已提交
1139

1140
设置触控板轻触功能开关,使用Promise异步方式返回结果。
X
xixian_2023 已提交
1141 1142 1143 1144 1145 1146 1147 1148 1149

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
1150
| state | boolean| 是    |  触控板轻触功能开关开启状态。 true代表轻触开启,false代表轻触关闭,默认开启。  |
X
xixian_2023 已提交
1151 1152 1153 1154 1155

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
1156
| Promise\<void> | Promise对象。 |
X
xixian_2023 已提交
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171

**示例**

```js
try {
  pointer.setTouchpadTapSwitch(false).then(() => {
    console.log(`setTouchpadTapSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadTapSwitch<sup>10+</sup>

1172
getTouchpadTapSwitch(callback:  AsyncCallback\<boolean>): void
X
xixian_2023 已提交
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183

获取触控板轻触能力开启状态,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
1184
| callback | AsyncCallback\<boolean> | 是    | 回调函数,异步返回触控板轻触功能开启状态。 |
X
xixian_2023 已提交
1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199

**示例**

```js
try {
  pointer.getTouchpadTapSwitch((error, state) => {
    console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadTapSwitch<sup>10+</sup>

1200
getTouchpadTapSwitch(): Promise\<boolean>
X
xixian_2023 已提交
1201

1202
获取触控板轻触功能开启状态,使用Promise异步方式返回结果。
X
xixian_2023 已提交
1203 1204 1205 1206 1207 1208 1209 1210 1211

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
1212
| Promise\<boolean> | Promise实例,异步返回触控板轻触功能开启状态。 |
X
xixian_2023 已提交
1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227

**示例**

```js
try {
  pointer.getTouchpadTapSwitch().then((state) => {
    console.log(`getTouchpadTapSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadPointerSpeed<sup>10+</sup>

1228
setTouchpadPointerSpeed(speed: number, callback: AsyncCallback\<void>): void
X
xixian_2023 已提交
1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239

设置触控板光标移动速度,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
1240 1241
| speed | number                    | 是    |speed代表光标移动速度。speed取值范围[1,11],默认5。  |
| callback | AsyncCallback\<void> | 是    | 回调函数。 |
X
xixian_2023 已提交
1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260

**示例**

```js
try {
  pointer.setTouchpadPointerSpeed(1, (error) => {
    if (error) {
      console.log(`setTouchpadPointerSpeedfailed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setTouchpadPointerSpeed success`);
  });
} catch (error) {
  console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadPointerSpeed<sup>10+</sup>

1261
setTouchpadPointerSpeed(speed: number): Promise\<void>
X
xixian_2023 已提交
1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272

设置触控板光标移动速度,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
1273
| speed| number | 是    | speed代表光标移动速度。speed取值范围[1,11],默认5。    |
X
xixian_2023 已提交
1274 1275 1276 1277 1278

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
1279
| Promise\<void> | Promise对象。 |
X
xixian_2023 已提交
1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294

**示例**

```js
try {
  pointer.setTouchpadPointerSpeed(10).then(() => {
    console.log(`setTouchpadPointerSpeed success`);
  });
} catch (error) {
  console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadPointerSpeed<sup>10+</sup>

1295
getTouchpadPointerSpeed(callback: AsyncCallback\<number>): void
X
xixian_2023 已提交
1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306

获取触控板光标移动速度,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
1307
| callback | AsyncCallback\<number> | 是    | 回调函数,异步返回触控板光标移动速度。 |
X
xixian_2023 已提交
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322

**示例**

```js
try {
  pointer.getTouchpadPointerSpeed((error, speed) => {
    console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`);
  });
} catch (error) {
  console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadPointerSpeed<sup>10+</sup>

1323
getTouchpadPointerSpeed(): Promise\<number>
X
xixian_2023 已提交
1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334

获取触控板光标移动速度,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
1335
| Promise\<number> | Promise实例,异步返回触控板光标移动速度。 |
X
xixian_2023 已提交
1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346

**示例**

```js
try {
  pointer.getTouchpadPointerSpeed().then((speed) => {
    console.log(`getTouchpadPointerSpeed success, speed: ${JSON.stringify(speed)}`);
  });
} catch (error) {
  console.log(`getTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
X
xixian_2023 已提交
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419
```

## pointer.setTouchpadPinchSwitch<sup>10+</sup>

setTouchpadPinchSwitch(state: boolean, callback: AsyncCallback\<void>): void

设置触控板双指捏合功能开关,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是    |触控板双指捏合功能开关开启状态。 true代表开启,false代表关闭,默认开启。   |
| callback | AsyncCallback\<void> | 是    | 回调函数。 |

**示例**

```js
try {
  pointer.setTouchpadTapSwitch(true, (error) => {
    if (error) {
      console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setTouchpadPinchSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadPinchSwitch<sup>10+</sup>

setTouchpadPinchSwitch(state: boolean): Promise\<void>

设置触控板双指捏合功能开关,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是    |  触控板双指捏合功能开关开启状态。 true代表开启,false代表关闭,默认开启。  |

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise\<void> | Promise对象。 |

**示例**

```js
try {
  pointer.setTouchpadPinchSwitch(false).then(() => {
    console.log(`setTouchpadPinchSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadPinchSwitch<sup>10+</sup>

getTouchpadPinchSwitch(callback:  AsyncCallback\<boolean>): void

1420
获取触控板双指捏合功能开启状态,使用AsyncCallback异步方式返回结果。
X
xixian_2023 已提交
1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\<boolean> | 是    | 回调函数,异步返回触控板双指捏合功能开启状态。 |

**示例**

```js
try {
  pointer.getTouchpadPinchSwitch((error, state) => {
    console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadPinchSwitch<sup>10+</sup>

getTouchpadPinchSwitch(): Promise\<boolean>

获取触控板双指捏合功能开启状态,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| Promise\<boolean> | Promise实例,异步返回触控板双指捏合功能开启状态。 |

**示例**

```js
try {
  pointer.getTouchpadPinchSwitch().then((state) => {
    console.log(`getTouchpadPinchSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadSwipeSwitch<sup>10+</sup>

setTouchpadSwipeSwitch(state: boolean, callback: AsyncCallback\<void>): void

1476
设置触控板多指滑动功能开关,使用AsyncCallback异步方式返回结果。
X
xixian_2023 已提交
1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
| state | boolean | 是    |触控板多指滑动开关开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。   |
| callback | AsyncCallback\<void> | 是    | 回调函数。 |

**示例**

```js
try {
  pointer.setTouchpadSwipeSwitch(true, (error) => {
    if (error) {
      console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setTouchpadSwipeSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadSwipeSwitch<sup>10+</sup>

setTouchpadSwipeSwitch(state: boolean): Promise\<void>

设置触控板多指滑动功能开关,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| state | boolean| 是    |  触控板多指滑动功能开关开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。  |

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise\<void> | Promise对象。 |

**示例**

```js
try {
  pointer.setTouchpadSwipeSwitch(false).then(() => {
    console.log(`setTouchpadSwipeSwitch success`);
  });
} catch (error) {
  console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadSwipeSwitch<sup>10+</sup>

getTouchpadSwipeSwitch(callback:  AsyncCallback\<boolean>): void

1543
获取触控板多指滑动功能开启状态,使用AsyncCallback异步方式返回结果。
X
xixian_2023 已提交
1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\<boolean> | 是    | 回调函数,异步返回触控板多指滑动功能开启状态。 |

**示例**

```js
try {
  pointer.getTouchpadSwipeSwitch((error, state) => {
    console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadSwipeSwitch<sup>10+</sup>

getTouchpadSwipeSwitch(): Promise\<boolean>

获取触控板多指滑动功能开启状态,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| Promise\<boolean> | Promise实例,异步返回触控板多指滑动功能开启状态。 |

**示例**

```js
try {
  pointer.getTouchpadSwipeSwitch().then((state) => {
    console.log(`getTouchpadSwipeSwitch success, state: ${JSON.stringify(state)}`);
  });
} catch (error) {
  console.log(`getTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

1595
## RightClickType<sup>10+</sup>
1596 1597 1598 1599 1600 1601 1602

右键菜单触发方式。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

| 名称                               | 值    | 说明     |
| -------------------------------- | ---- | ------ |
1603 1604 1605
| TOUCHPAD_RIGHT_BUTTON            | 1    |触控板右键区域。 |
| TOUCHPAD_LEFT_BUTTON            | 2    |触控板左键区域。 |
| TOUCHPAD_TWO_FINGER_TAP         | 3    |双指轻击或按压触控板。|
1606

X
xixian_2023 已提交
1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620
## pointer.setTouchpadRightClickType<sup>10+</sup>

setTouchpadRightClickType(type: RightClickType, callback: AsyncCallback\<void>): void

设置触控板右键菜单类型,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
1621
| type| RightClickType| 是    |type代表触控板右键菜单类型。<br>- TOUCHPAD_RIGHT_BUTTON:触控板右键区域。<br>- TOUCHPAD_LEFT_BUTTON:触控板左键区域。<br>- TOUCHPAD_TWO_FINGER_TAP:双指轻击或按压触控板。<br>默认为TOUCHPAD_RIGHT_BUTTON 。  |
X
xixian_2023 已提交
1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653
| callback | AsyncCallback\<void> | 是    | 回调函数。 |

**示例**

```js
try {
  pointer.setTouchpadRightClickType(RightClickType::TOUCHPAD_RIGHT_BUTTON , (error) => {
    if (error) {
      console.log(`setTouchpadRightClickType, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setTouchpadRightClickType success`);
  });
} catch (error) {
  console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setTouchpadRightClickType<sup>10+</sup>

setTouchpadRightClickType(type: RightClickType): Promise\<void>

设置触控板右键菜单类型,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
1654
| type| RightClickType| 是    | type代表触控板右键菜单类型。<br>- TOUCHPAD_RIGHT_BUTTON:触控板右键区域。<br>- TOUCHPAD_LEFT_BUTTON:触控板左键区域。<br>- TOUCHPAD_TWO_FINGER_TAP:双指轻击或按压触控板。<br>默认为TOUCHPAD_RIGHT_BUTTON 。 |
X
xixian_2023 已提交
1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise\<void> | Promise对象。 |

**示例**

```js
try {
  pointer.setTouchpadRightClickType(RightClickType::TOUCHPAD_RIGHT_BUTTON ).then(() => {
    console.log(`setTouchpadRightClickType success`);
  });
} catch (error) {
  console.log(`setTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadRightClickType<sup>10+</sup>

getTouchpadRightClickType(callback: AsyncCallback\<RightClickType>): void

获取触控板右键菜单类型,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback\<RightClickType> | 是    | 回调函数,异步返回触控板右键菜单类型。 |

**示例**

```js
try {
  pointer.getTouchpadRightClickType((error, type) => {
    console.log(`getTouchpadRightClickType success, type: ${JSON.stringify(type)}`);
  });
} catch (error) {
  console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getTouchpadRightClickType<sup>10+</sup>

getTouchpadRightClickType(): Promise\<RightClickType>

获取触控板右键菜单类型,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| Promise\<RightClickType > | Promise实例,异步返回触控板右键菜单类型。 |

**示例**

```js
try {
  pointer.getTouchpadRightClickType().then((type) => {
    console.log(`getTouchpadRightClickType success, typeed: ${JSON.stringify(type)}`);
  });
} catch (error) {
  console.log(`getTouchpadRightClickType failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
X
xixian_2023 已提交
1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081
```

## pointer.setPointerSize<sup>10+</sup>

setPointerSize(size: number, callback: AsyncCallback&lt;void&gt;): void

设置鼠标光标大小,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
| size     | number                    | 是    | 鼠标光标大小,范围为[1-7],默认为1。   |
| callback | AsyncCallback&lt;void&gt; | 是    | 回调函数,当设置成功时,err为undefined,否则为错误对象。 |

**示例**

```js
try {
  pointer.setPointerSize(1, (error) => {
    if (error) {
      console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setPointerSize success`);
  });
} catch (error) {
  console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setPointerSize<sup>10+</sup>

setPointerSize(size: number): Promise&lt;void&gt;

设置鼠标光标大小,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| size  | number | 是    | 鼠标光标大小,范围为[1-7],默认为1。 |

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |

**示例**

```js
try {
  pointer.setPointerSize(3).then(() => {
    console.log(`setPointerSize success`);
  });
} catch (error) {
  console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setPointerSizeSync<sup>10+</sup>

setPointerSizeSync(size: number): void;

设置鼠标光标大小,使用同步方式进行设置。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| size  | number | 是    | 鼠标光标大小,范围为[1-7],默认为1。 |

**示例**

```js
try {
  pointer.setPointerSizeSync(5);
  console.log(`setPointerSizeSync success`);
} catch (error) {
  console.log(`setPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getPointerSize<sup>10+</sup>

getPointerSize(callback: AsyncCallback&lt;number&gt;): void

获取鼠标光标大小,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback&lt;number&gt; | 是    | 回调函数,异步返回鼠标光标大小。 |

**示例**

```js
try {
  pointer.getPointerSize((error, size) => {
    console.log(`getPointerSize success, size: ${JSON.stringify(size)}`);
  });
} catch (error) {
  console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getPointerSize<sup>10+</sup>

getPointerSize(): Promise&lt;number&gt;

获取当前鼠标光标大小,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| Promise&lt;number&gt; | Promise对象,异步返回鼠标光标大小。 |

**示例**

```js
try {
  pointer.getPointerSize().then((size) => {
    console.log(`getPointerSize success, size: ${JSON.stringify(size)}`);
  });
} catch (error) {
  console.log(`getPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getPointerSizeSync<sup>10+</sup>

getPointerSizeSync(): number

获取鼠标光标大小,使用同步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| number | 鼠标光标大小。 |

**示例**

```js
try {
  let pointerSize = pointer.getPointerSizeSync();
  console.log(`getPointerSizeSync success, pointerSize: ${JSON.stringify(pointerSize)}`);
} catch (error) {
  console.log(`getPointerSizeSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setPointerColor<sup>10+</sup>

setPointerColor(color: number, callback: AsyncCallback&lt;void&gt;): void

设置鼠标光标颜色,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                        | 必填   | 说明                                    |
| -------- | ------------------------- | ---- | ------------------------------------- |
| color     | number                    | 是    | 鼠标光标颜色,默认为黑色:0x000000。   |
| callback | AsyncCallback&lt;void&gt; | 是    | 回调函数,当设置成功时,err为undefined,否则为错误对象。 |

**示例**

```js
try {
  pointer.setPointerColor(0xF6C800, (error) => {
    if (error) {
      console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
      return;
    }
    console.log(`setPointerColor success`);
  });
} catch (error) {
  console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setPointerColor<sup>10+</sup>

setPointerColor(color: number): Promise&lt;void&gt;

设置鼠标光标颜色,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| color  | number | 是    | 鼠标光标颜色,默认为黑色:0x000000。 |

**返回值**

| 参数                  | 说明               |
| ------------------- | ---------------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |

**示例**

```js
try {
  pointer.setPointerColor(0xF6C800).then(() => {
    console.log(`setPointerColor success`);
  });
} catch (error) {
  console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.setPointerColorSync<sup>10+</sup>

setPointerColorSync(color: number): void;

设置鼠标光标颜色,使用同步方式进行设置。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名    | 类型     | 必填   | 说明                                  |
| ----- | ------ | ---- | ----------------------------------- |
| color  | number | 是    | 鼠标光标颜色,默认为黑色:0x000000。 |

**示例**

```js
try {
  pointer.setPointerColorSync(0xF6C800);
  console.log(`setPointerColorSync success`);
} catch (error) {
  console.log(`setPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getPointerColor<sup>10+</sup>

getPointerColor(callback: AsyncCallback&lt;number&gt;): void

获取鼠标光标颜色,使用AsyncCallback异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**参数**

| 参数名       | 类型                          | 必填   | 说明             |
| -------- | --------------------------- | ---- | -------------- |
| callback | AsyncCallback&lt;number&gt; | 是    | 回调函数,异步返回鼠标光标颜色。 |

**示例**

```js
try {
  pointer.getPointerColor((error, color) => {
    console.log(`getPointerColor success, color: ${JSON.stringify(color)}`);
  });
} catch (error) {
  console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getPointerColor<sup>10+</sup>

getPointerColor(): Promise&lt;number&gt;

获取当前鼠标光标颜色,使用Promise异步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| Promise&lt;number&gt; | Promise对象,异步返回鼠标光标颜色。 |

**示例**

```js
try {
  pointer.getPointerColor().then((color) => {
    console.log(`getPointerColor success, color: ${JSON.stringify(color)}`);
  });
} catch (error) {
  console.log(`getPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```

## pointer.getPointerColorSync<sup>10+</sup>

getPointerColorSync(): number

获取鼠标光标颜色,使用同步方式返回结果。

**系统能力**:SystemCapability.MultimodalInput.Input.Pointer

**系统API**: 此接口为系统接口。

**返回值**

| 参数                    | 说明                  |
| --------------------- | ------------------- |
| number | 鼠标光标颜色。 |

**示例**

```js
try {
  let pointerColor = pointer.getPointerColorSync();
  console.log(`getPointerColorSync success, pointerColor: ${JSON.stringify(pointerColor)}`);
} catch (error) {
  console.log(`getPointerColorSync failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
X
xixian_2023 已提交
2082
```