# @ohos.multimodalInput.pointer (鼠标指针) 鼠标指针管理模块,用于查询和设置鼠标指针相关属性。 > **说明**: > > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 ## 导入模块 ```js import pointer from '@ohos.multimodalInput.pointer'; ``` ## pointer.setPointerVisible9+ setPointerVisible(visible: boolean, callback: AsyncCallback<void>): void 设置鼠标指针显示或者隐藏,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------------------------- | | visible | boolean | 是 | 鼠标指针是否显示。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例**: ```js try { pointer.setPointerVisible(true, (error) => { if (error) { console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Set pointer visible success`); }); } catch (error) { console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.setPointerVisible9+ setPointerVisible(visible: boolean): Promise<void> 设置鼠标指针显示或者隐藏,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **参数**: | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ---------------------------------------- | | visible | boolean | 是 | 鼠标指针是否显示。 | **返回值**: | 参数 | 说明 | | ------------------- | ------------------- | | Promise<void> | Promise对象。 | **示例**: ```js try { pointer.setPointerVisible(false).then(() => { console.log(`Set pointer visible success`); }); } catch (error) { console.log(`Set pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.isPointerVisible9+ isPointerVisible(callback: AsyncCallback<boolean>): void 获取鼠标指针显示或隐藏状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------- | ---- | -------------- | | callback | AsyncCallback<boolean> | 是 | 回调函数,异步返回鼠标指针显示或隐藏状态。 | **示例**: ```js try { 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)}`); }); } catch (error) { console.log(`Get pointer visible failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.isPointerVisible9+ isPointerVisible(): Promise<boolean> 获取鼠标指针显示或隐藏状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **返回值**: | 参数 | 说明 | | ---------------------- | ------------------- | | Promise<boolean> | Promise对象,异步返回鼠标指针显示或隐藏状态。 | **示例**: ```js 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`])}`); } ``` ## pointer.setPointerSpeed9+ setPointerSpeed(speed: number, callback: AsyncCallback<void>): void 设置鼠标移动速度,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | speed | number | 是 | 鼠标移动速度,范围1-11,默认为5。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例**: ```js try { pointer.setPointerSpeed(5, (error) => { if (error) { console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); return; } console.log(`Set pointer speed success`); }); } catch (error) { console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.setPointerSpeed9+ setPointerSpeed(speed: number): Promise<void> 设置鼠标移动速度,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | speed | number | 是 | 鼠标移动速度,范围1-11,默认为5。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise<void> | Promise对象。 | **示例**: ```js try { pointer.setPointerSpeed(5).then(() => { console.log(`Set pointer speed success`); }); } catch (error) { console.log(`Set pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getPointerSpeed9+ getPointerSpeed(callback: AsyncCallback<number>): void 获取鼠标移动速度,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标移动速度。 | **示例**: ```js try { pointer.getPointerSpeed((error, speed) => { 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)}`); }); } catch (error) { console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getPointerSpeed9+ getPointerSpeed(): Promise<number> 获取当前鼠标移动速度,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise<number> | Promise实例,异步返回鼠标移动速度。 | **示例**: ```js try { pointer.getPointerSpeed().then(speed => { console.log(`Get pointer speed success, speed: ${JSON.stringify(speed)}`); }); } catch (error) { console.log(`Get pointer speed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.setHoverScrollState10+ setHoverScrollState(state: boolean, callback: AsyncCallback<void>): void 设置鼠标悬停滚动开关状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | state | boolean | 是 | 鼠标悬停滚动开关状态。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例**: ```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.setHoverScrollState10+ setHoverScrollState(state: boolean): Promise<void> 设置鼠标悬停滚动开关状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | state | boolean | 是 | 鼠标悬停滚动开关状态。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise<void> | 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.getHoverScrollState10+ getHoverScrollState(callback: AsyncCallback<boolean>): void 获取鼠标悬停滚动开关状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback<boolean> | 是 | 回调函数,异步返回鼠标悬停滚动开关状态。 | **示例**: ```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.getHoverScrollState10+ getHoverScrollState(): Promise<boolean> 获取当前鼠标悬停滚动开关状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise<boolean> | 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.setMousePrimaryButton10+ setMousePrimaryButton(primary: PrimaryButton, callback: AsyncCallback<void>): void 设置鼠标主键,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | primary | [PrimaryButton](#primarybutton10) | 是 | 鼠标主键id。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例**: ```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.setMousePrimaryButton10+ setMousePrimaryButton(primary: PrimaryButton): Promise<void> 设置鼠标主键,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | primary | [PrimaryButton](#primarybutton10) | 是 | 鼠标主键id。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise<void> | 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.getMousePrimaryButton10+ getMousePrimaryButton(callback: AsyncCallback<PrimaryButton>): void 获取鼠标主键,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback<[PrimaryButton](#primarybutton10)> | 是 | 回调函数,异步返回鼠标主键。 | **示例**: ```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.getMousePrimaryButton10+ getMousePrimaryButton(): Promise<PrimaryButton> 获取当前鼠标主键,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise<[PrimaryButton](#primarybutton10)> | Promise实例,异步返回鼠标主键。 | **示例**: ```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`])}`); } ``` ## PrimaryButton10+ 鼠标主键类型。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer | 名称 | 值 | 说明 | | -------------------------------- | ---- | ------ | | LEFT | 0 | 鼠标左键 | | RIGHT | 1 | 鼠标右键 | ## pointer.setMouseScrollRows10+ setMouseScrollRows(rows: number, callback: AsyncCallback<void>): void 设置鼠标滚动行数,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | rows | number | 是 | 鼠标滚动行数,范围1-100,默认为3。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例**: ```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.setMouseScrollRows10+ setMouseScrollRows(rows: number): Promise<void> 设置鼠标滚动行数,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | rows | number | 是 | 鼠标滚动行数,范围1-100,默认为3。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise<void> | Promise对象。 | **示例**: ```js try { pointer.setMouseScrollRows(20).then(() => { console.log(`setMouseScrollRows success`); }); } catch (error) { console.log(`setMouseScrollRows failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getMouseScrollRows10+ getMouseScrollRows(callback: AsyncCallback<number>): void 获取鼠标滚动行数,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标滚动行数。 | **示例**: ```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.getMouseScrollRows10+ getMouseScrollRows(): Promise<number> 获取当前鼠标滚动行数,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise<number> | 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`])}`); } ``` ## pointer.getPointerStyle9+ getPointerStyle(windowId: number, callback: AsyncCallback<PointerStyle>): void 获取鼠标样式类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | -------------- | | windowId | number | 是 | 窗口id。 | | callback | AsyncCallback<[PointerStyle](#pointerstyle9)> | 是 | 回调函数,异步返回鼠标样式类型。 | **示例**: ```js import window from '@ohos.window'; 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`])}`); } }); ``` ## pointer.getPointerStyle9+ getPointerStyle(windowId: number): Promise<PointerStyle> 获取鼠标样式类型,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | -------- | | windowId | number | 是 | 窗口id。 | **返回值**: | 参数 | 说明 | | ---------------------------------------- | ------------------- | | Promise<[PointerStyle](#pointerstyle9)> | Promise实例,异步返回鼠标样式类型。 | **示例**: ```js import window from '@ohos.window'; 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`])}`); } }); ``` ## pointer.setPointerStyle9+ setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback<void>): void 设置鼠标样式类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **参数**: | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------------ | ---- | ----------------------------------- | | windowId | number | 是 | 窗口id。 | | pointerStyle | [PointerStyle](#pointerstyle9) | 是 | 鼠标样式id。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例**: ```js import window from '@ohos.window'; 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`])}`); } }); ``` ## pointer.setPointerStyle9+ setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise<void> 设置鼠标样式类型,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **参数**: | 参数名 | 类型 | 必填 | 说明 | | ------------------- | ------------------------------ | ---- | ---------------- | | windowId | number | 是 | 窗口id。 | | pointerStyle | [PointerStyle](#pointerstyle9) | 是 | 鼠标样式id。 | | Promise<void> | void | 是 | Promise对象。 | **示例**: ```js import window from '@ohos.window'; 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`])}`); } }); ``` ## PointerStyle9+ 鼠标样式类型。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer | 名称 | 值 | 说明 |图示 | | -------------------------------- | ---- | ------ |------ | | 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)| | MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38 | 四向锥形移动 |![MID_Btn_North_South_West_East.png](./figures/MID_Btn_North_South_West_East.png)| | HORIZONTAL_TEXT_CURSOR10+ | 39 | 垂直文本选择 |![Horizontal_Text_Cursor.png](./figures/Horizontal_Text_Cursor.png)| | CURSOR_CROSS10+ | 40 | 十字光标 |![Cursor_Cross.png](./figures/Cursor_Cross.png)| | CURSOR_CIRCLE10+ | 41 | 圆形光标 |![Cursor_Circle.png](./figures/Cursor_Circle.png)| ## pointer.setTouchpadScrollSwitch10+ setTouchpadScrollSwitch(state: boolean, callback: AsyncCallback\): void 设置触控板滚轴开关,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | state | boolean | 是 | 滚轴开关开启的状态,true代表开启,false代表关闭,默认为开启 | | callback | AsyncCallback\ | 是 | 回调函数。 | **示例**: ```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.setTouchpadScrollSwitch10+ setTouchpadScrollSwitch(state: boolean): Promise\ 设置触控板滚轴开关,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | state | boolean| 是 | 滚轴开关开启的状态,true代表开启,false代表关闭,默认为开启 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise\ | Promise对象。 | **示例**: ```js try { pointer.setTouchpadScrollSwitch(false).then(() => { console.log(`setTouchpadScrollSwitch success`); }); } catch (error) { console.log(`setTouchpadScrollSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getTouchpadScrollSwitch10+ getTouchpadScrollSwitch(callback: AsyncCallback\): void 获取触控板滚轴能力开启状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板滚轴能力开启状态。 | **示例**: ```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.getTouchpadScrollSwitch10+ getTouchpadScrollSwitch(): Promise\ 获取触控板滚轴能力开启状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise\ | Promise实例,异步返回触控板滚轴能力开启状态。 | **示例**: ```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.setTouchpadScrollDirection10+ setTouchpadScrollDirection(state: boolean, callback: AsyncCallback\): void 设置触控板滚轴的方向,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | state | boolean | 是 | state为触控板滚轴的方向。true与手指滑动的方向一致,false与手指滑动的方向相反,默认为true。 | | callback | AsyncCallback\ | 是 | 回调函数。 | **示例**: ```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.setTouchpadScrollDirection10+ setTouchpadScrollDirection(state: boolean): Promise\ 设置触控板滚轴的方向,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | state | boolean| 是 | state为触控板滚轴的方向。true与手指滑动的方向一致,false与手指滑动的方向相反,默认为true。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise\ | Promise对象。 | **示例**: ```js try { pointer.setTouchpadScrollDirection (false).then(() => { console.log(`setTouchpadScrollDirection success`); }); } catch (error) { console.log(`setTouchpadScrollDirection failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getTouchpadScrollDirection10+ getTouchpadScrollDirection(callback: AsyncCallback\): void 获取触控板滚轴方向,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板滚轴方向。 | **示例**: ```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.getTouchpadScrollDirection10+ getTouchpadScrollDirection(): Promise\ 获取触控板滚轴方向,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise\ | Promise实例,异步返回触控板滚轴方向。 | **示例**: ```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.setTouchpadTapSwitch10+ setTouchpadTapSwitch(state: boolean, callback: AsyncCallback\): void 设置触控板轻触功能开关,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | state | boolean | 是 |触控板轻触功能开关开启状态。 true代表轻触开启,false代表轻触关闭,默认开启。 | | callback | AsyncCallback\ | 是 | 回调函数。 | **示例**: ```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 10+ setTouchpadTapSwitch(state: boolean): Promise\ 设置触控板轻触功能开关,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | state | boolean| 是 | 触控板轻触功能开关开启状态。 true代表轻触开启,false代表轻触关闭,默认开启。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise\ | Promise对象。 | **示例**: ```js try { pointer.setTouchpadTapSwitch(false).then(() => { console.log(`setTouchpadTapSwitch success`); }); } catch (error) { console.log(`setTouchpadTapSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getTouchpadTapSwitch10+ getTouchpadTapSwitch(callback: AsyncCallback\): void 获取触控板轻触能力开启状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板轻触功能开启状态。 | **示例**: ```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.getTouchpadTapSwitch10+ getTouchpadTapSwitch(): Promise\ 获取触控板轻触功能开启状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise\ | Promise实例,异步返回触控板轻触功能开启状态。 | **示例**: ```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.setTouchpadPointerSpeed10+ setTouchpadPointerSpeed(speed: number, callback: AsyncCallback\): void 设置触控板光标移动速度,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | speed | number | 是 |speed代表光标移动速度。speed取值范围[1,11],默认5。 | | callback | AsyncCallback\ | 是 | 回调函数。 | **示例**: ```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.setTouchpadPointerSpeed10+ setTouchpadPointerSpeed(speed: number): Promise\ 设置触控板光标移动速度,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | speed| number | 是 | speed代表光标移动速度。speed取值范围[1,11],默认5。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise\ | Promise对象。 | **示例**: ```js try { pointer.setTouchpadPointerSpeed(10).then(() => { console.log(`setTouchpadPointerSpeed success`); }); } catch (error) { console.log(`setTouchpadPointerSpeed failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getTouchpadPointerSpeed10+ getTouchpadPointerSpeed(callback: AsyncCallback\): void 获取触控板光标移动速度,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板光标移动速度。 | **示例**: ```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.getTouchpadPointerSpeed10+ getTouchpadPointerSpeed(): Promise\ 获取触控板光标移动速度,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise\ | Promise实例,异步返回触控板光标移动速度。 | **示例**: ```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`])}`); } ``` ## pointer.setTouchpadPinchSwitch10+ setTouchpadPinchSwitch(state: boolean, callback: AsyncCallback\): void 设置触控板双指捏合功能开关,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | state | boolean | 是 |触控板双指捏合功能开关开启状态。 true代表开启,false代表关闭,默认开启。 | | callback | AsyncCallback\ | 是 | 回调函数。 | **示例**: ```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.setTouchpadPinchSwitch10+ setTouchpadPinchSwitch(state: boolean): Promise\ 设置触控板双指捏合功能开关,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | state | boolean| 是 | 触控板双指捏合功能开关开启状态。 true代表开启,false代表关闭,默认开启。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise\ | Promise对象。 | **示例**: ```js try { pointer.setTouchpadPinchSwitch(false).then(() => { console.log(`setTouchpadPinchSwitch success`); }); } catch (error) { console.log(`setTouchpadPinchSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getTouchpadPinchSwitch10+ getTouchpadPinchSwitch(callback: AsyncCallback\): void 获取触控板双指捏合功能开启状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板双指捏合功能开启状态。 | **示例**: ```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.getTouchpadPinchSwitch10+ getTouchpadPinchSwitch(): Promise\ 获取触控板双指捏合功能开启状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise\ | 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.setTouchpadSwipeSwitch10+ setTouchpadSwipeSwitch(state: boolean, callback: AsyncCallback\): void 设置触控板多指滑动功能开关,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | state | boolean | 是 |触控板多指滑动开关开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。 | | callback | AsyncCallback\ | 是 | 回调函数。 | **示例**: ```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.setTouchpadSwipeSwitch10+ setTouchpadSwipeSwitch(state: boolean): Promise\ 设置触控板多指滑动功能开关,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | state | boolean| 是 | 触控板多指滑动功能开关开启状态。 true代表多指滑动开启,false代表多指滑动关闭,默认开启。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise\ | Promise对象。 | **示例**: ```js try { pointer.setTouchpadSwipeSwitch(false).then(() => { console.log(`setTouchpadSwipeSwitch success`); }); } catch (error) { console.log(`setTouchpadSwipeSwitch failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.getTouchpadSwipeSwitch10+ getTouchpadSwipeSwitch(callback: AsyncCallback\): void 获取触控板多指滑动功能开启状态,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板多指滑动功能开启状态。 | **示例**: ```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.getTouchpadSwipeSwitch10+ getTouchpadSwipeSwitch(): Promise\ 获取触控板多指滑动功能开启状态,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise\ | 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`])}`); } ``` ## RightClickType10+ 右键菜单触发方式。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer | 名称 | 值 | 说明 | | -------------------------------- | ---- | ------ | | TOUCHPAD_RIGHT_BUTTON | 1 |触控板右键区域。 | | TOUCHPAD_LEFT_BUTTON | 2 |触控板左键区域。 | | TOUCHPAD_TWO_FINGER_TAP | 3 |双指轻击或按压触控板。| ## pointer.setTouchpadRightClickType10+ setTouchpadRightClickType(type: RightClickType, callback: AsyncCallback\): void 设置触控板右键菜单类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | type| RightClickType| 是 |type代表触控板右键菜单类型。
- TOUCHPAD_RIGHT_BUTTON:触控板右键区域。
- TOUCHPAD_LEFT_BUTTON:触控板左键区域。
- TOUCHPAD_TWO_FINGER_TAP:双指轻击或按压触控板。
默认为TOUCHPAD_RIGHT_BUTTON 。 | | callback | AsyncCallback\ | 是 | 回调函数。 | **示例**: ```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.setTouchpadRightClickType10+ setTouchpadRightClickType(type: RightClickType): Promise\ 设置触控板右键菜单类型,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | type| RightClickType| 是 | type代表触控板右键菜单类型。
- TOUCHPAD_RIGHT_BUTTON:触控板右键区域。
- TOUCHPAD_LEFT_BUTTON:触控板左键区域。
- TOUCHPAD_TWO_FINGER_TAP:双指轻击或按压触控板。
默认为TOUCHPAD_RIGHT_BUTTON 。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise\ | 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.getTouchpadRightClickType10+ getTouchpadRightClickType(callback: AsyncCallback\): void 获取触控板右键菜单类型,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback\ | 是 | 回调函数,异步返回触控板右键菜单类型。 | **示例**: ```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.getTouchpadRightClickType10+ getTouchpadRightClickType(): Promise\ 获取触控板右键菜单类型,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise\ | 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`])}`); } ``` ## pointer.setPointerSize10+ setPointerSize(size: number, callback: AsyncCallback<void>): void 设置鼠标光标大小,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | size | number | 是 | 鼠标光标大小,范围为[1-7],默认为1。 | | callback | AsyncCallback<void> | 是 | 回调函数,当设置成功时,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.setPointerSize10+ setPointerSize(size: number): Promise<void> 设置鼠标光标大小,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | size | number | 是 | 鼠标光标大小,范围为[1-7],默认为1。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **示例**: ```js try { pointer.setPointerSize(3).then(() => { console.log(`setPointerSize success`); }); } catch (error) { console.log(`setPointerSize failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.setPointerSizeSync10+ 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.getPointerSize10+ getPointerSize(callback: AsyncCallback<number>): void 获取鼠标光标大小,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标光标大小。 | **示例**: ```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.getPointerSize10+ getPointerSize(): Promise<number> 获取当前鼠标光标大小,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise<number> | 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.getPointerSizeSync10+ 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.setPointerColor10+ setPointerColor(color: number, callback: AsyncCallback<void>): void 设置鼠标光标颜色,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------- | | color | number | 是 | 鼠标光标颜色,默认为黑色:0x000000。 | | callback | AsyncCallback<void> | 是 | 回调函数,当设置成功时,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.setPointerColor10+ setPointerColor(color: number): Promise<void> 设置鼠标光标颜色,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ----------------------------------- | | color | number | 是 | 鼠标光标颜色,默认为黑色:0x000000。 | **返回值**: | 参数 | 说明 | | ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **示例**: ```js try { pointer.setPointerColor(0xF6C800).then(() => { console.log(`setPointerColor success`); }); } catch (error) { console.log(`setPointerColor failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } ``` ## pointer.setPointerColorSync10+ 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.getPointerColor10+ getPointerColor(callback: AsyncCallback<number>): void 获取鼠标光标颜色,使用AsyncCallback异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **参数**: | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | -------------- | | callback | AsyncCallback<number> | 是 | 回调函数,异步返回鼠标光标颜色。 | **示例**: ```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.getPointerColor10+ getPointerColor(): Promise<number> 获取当前鼠标光标颜色,使用Promise异步方式返回结果。 **系统能力**:SystemCapability.MultimodalInput.Input.Pointer **系统API**: 此接口为系统接口。 **返回值**: | 参数 | 说明 | | --------------------- | ------------------- | | Promise<number> | 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.getPointerColorSync10+ 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`])}`); } ```