提交 b3fea490 编写于 作者: M mayunteng_1

键鼠穿越doc修改

Signed-off-by: Nmayunteng_1 <mayunteng@huawei.com>
Change-Id: I4485fe4cbb6ca245a69c766c740010d04d646f58
上级 f9fbc983
......@@ -219,7 +219,7 @@
- [@ohos.geolocation (位置服务)](js-apis-geolocation.md)
- [@ohos.multimodalInput.inputConsumer (组合按键)](js-apis-inputconsumer.md)
- [@ohos.multimodalInput.inputDevice (输入设备)](js-apis-inputdevice.md)
- [@ohos.multimodalInput.inputDeviceCooperate (键鼠穿越管理)](js-apis-cooperate.md)
- [@ohos.multimodalInput.inputDeviceCooperate (键鼠穿越)](js-apis-cooperate.md)
- [@ohos.multimodalInput.inputEvent (输入事件)](js-apis-inputevent.md)
- [@ohos.multimodalInput.inputEventClient (按键注入)](js-apis-inputeventclient.md)
- [@ohos.multimodalInput.inputMonitor (输入监听)](js-apis-inputmonitor.md)
......
# 键鼠穿越管理
# 键鼠穿越
键鼠穿越功能,即两台或多台设备组网协同后可以共用一套键盘鼠标。
键鼠穿越管理模块,提供实现键盘、鼠标等外接输入设备的跨设备协同操作。在设备组网的情况下,提供多设备间共享键鼠的开关,设备穿越状态更新以及键鼠穿越光标自适应显示。
键鼠穿越功能模块,提供两台或多台设备组网协同后键鼠共享能力,实现键鼠输入设备的跨设备协同操作。
> **说明**
>
......@@ -15,18 +14,18 @@ import inputDeviceCooperate from '@ohos.multimodalInput.inputDeviceCooperate'
## inputDeviceCooperate.enable
enable(enable: boolean, callback: AsyncCallback\<void>): void
enable(enable: boolean, callback: AsyncCallback&lt;void&gt;): void
键鼠穿越开关开启或关闭,使用callback异步回调
开启、关闭键鼠穿越,使用AsyncCallback异步方式返回结果
**系统能力**: SystemCapability.MultimodalInput.Input.InputDeviceCooperate
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------------------------------------- |
| enable | boolean | 是 | 键鼠穿越开关开启或关闭状态。true: 键鼠穿越开关开启; false: 键鼠穿越开关关闭。
| callback | AsyncCallback\<void> | 是 | 异步回调函数。当键鼠穿越开关开启或关闭成功,err为undefined,否则为错误对象。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | --------------------------- |
| enable | boolean | 是 | 键鼠穿越使能状态。 |
| callback | AsyncCallback&lt;void&gt; | 是 |回调函数,异步返回键鼠穿越开启、关闭结果。 |
......@@ -34,23 +33,24 @@ enable(enable: boolean, callback: AsyncCallback\<void>): void
```js
try {
inputDeviceCooperate.enable(true, (err) => {
if (err) {
console.log(`Turn on the key mouse crossing switch failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
inputDeviceCooperate.enable(true, (error) => {
if (error) {
console.log(`Key mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Turn on the key mouse crossing switch success.`);
console.log(`Key mouse crossing enable success.`);
});
} catch (err) {
console.log(`Turn on the key mouse crossing switch failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Key mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## inputDeviceCooperate.enable
enable(enable: boolean): Promise\<void>
enable(enable: boolean): Promise&lt;void&gt;
开启、关闭键鼠穿越,使用Promise异步方式返回结果。
键鼠穿越开关开启或关闭,使用Promise方式作为异步方法。
**系统能力**: SystemCapability.MultimodalInput.Input.InputDeviceCooperate
......@@ -58,7 +58,7 @@ enable(enable: boolean): Promise\<void>
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------- | ---- | ------------------------------------------------------------------- |
| enable | boolean | 是 | 键鼠穿越开关开启或关闭状态。true: 键鼠穿越开关开启; false: 键鼠穿越开关关闭。 |
| enable | boolean | 是 | 键鼠穿越使能状态。 |
......@@ -66,7 +66,7 @@ enable(enable: boolean): Promise\<void>
| 参数 | 说明 |
| ------------------- | ------------------------------- |
| Promise\<void> | Promise实例,用于异步获取结果。 |
| Promise&lt;void&gt; | Promise对象,异步返回键鼠穿越开启、关闭结果。 |
......@@ -74,13 +74,13 @@ enable(enable: boolean): Promise\<void>
```js
try {
inputDeviceCooperate.enable(false).then((err) => {
console.log(`Turn on the key mouse crossing switch success`);
}, (err) => {
console.log(`Turn on the key mouse crossing switch failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
inputDeviceCooperate.enable(true).then(() => {
console.log(`Key mouse crossing enable success.`);
}, (error) => {
console.log(`Key mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (err) {
console.log(`Turn on the key mouse crossing switch failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Key mouse crossing enable failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -88,7 +88,7 @@ try {
start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback\<void>): void
启动键鼠穿越,使用callback异步回调
启动键鼠穿越,使用AsyncCallback异步方式返回结果
**系统能力**:SystemCapability.MultimodalInput.Input.InputDeviceCooperate
......@@ -98,7 +98,7 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCal
| -------- | ---------------------------- | ---- | ---------------------------- |
| sinkDeviceDescriptor | string | 是 | 键鼠穿越目标设备描述符。 |
| srcInputDeviceId | number | 是 | 键鼠穿越待穿越外设标识符。 |
| callback | AsyncCallback\<void> | 是 | 异步回调函数。当键鼠穿越启动成功,err为undefined,否则为错误对象。|
| callback | AsyncCallback\<void> | 是 | 回调函数,异步返回键鼠穿越启动、停止结果。|
**错误码:**
......@@ -106,22 +106,22 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCal
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 4400001 | Incorrect descriptor for the target device. |
| 4400002 | Failed to operate the input device. |
| 4400001 | 当调用键鼠穿越接口传入无效的设备描述符参数时,系统会产生此错误码。 |
| 4400002 | 当调用键鼠穿越接口时穿越状态异常,系统会产生此错误码。 |
**示例**
```js
try {
inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId, (err) => {
if (err) {
console.log(`Start key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId, (error) => {
if (error) {
console.log(`Start key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Start key mouse crossing success.`);
});
} catch (err) {
console.log(`Start key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Start key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -129,7 +129,7 @@ try {
start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise\<void>
启动键鼠穿越,使用Promise方式作为异步方法
启动键鼠穿越,使用Promise异步方式返回结果
**系统能力**: SystemCapability.MultimodalInput.Input.InputDeviceCooperate
......@@ -146,7 +146,7 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise\<void>
| 参数名 | 说明 |
| ---------------------- | ------------------------------- |
| Promise\<void> | Promise实例,用于异步获取结果。 |
| Promise\<void> | Promise对象,异步返回键鼠穿越启动、关闭结果。 |
**错误码:**
......@@ -154,20 +154,20 @@ start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise\<void>
| 错误码ID | 错误信息 |
| -------- | ---------------------------------------- |
| 4400001 | Incorrect descriptor for the target device. |
| 4400002 | Failed to operate the input device. |
| 4400001 | 当调用键鼠穿越接口传入无效的设备描述符参数时,系统会产生此错误码。 |
| 4400002 | 当调用键鼠穿越接口时穿越状态异常,系统会产生此错误码。 |
**示例**
```js
try {
inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId).then((err) => {
inputDeviceCooperate.start(sinkDeviceDescriptor, srcInputDeviceId).then(() => {
console.log(`Start key mouse crossing success.`);
}, (err) => {
console.log(`Start key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
}, (error) => {
console.log(`Start key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (err) {
console.log(`Start key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Start key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -175,7 +175,7 @@ try {
stop(callback: AsyncCallback\<void>): void
停止键鼠穿越,使用callback异步回调
停止键鼠穿越,使用AsyncCallback异步方式返回结果
**系统能力**:SystemCapability.MultimodalInput.Input.InputDeviceCooperate
......@@ -183,7 +183,7 @@ stop(callback: AsyncCallback\<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback\<void> | 是 | 异步回调函数,返回查询结果。 |
| callback | AsyncCallback\<void> | 是 | 回调函数,异步返回停止键鼠穿越结果。 |
......@@ -191,15 +191,15 @@ stop(callback: AsyncCallback\<void>): void
```js
try {
inputDeviceCooperate.stop((err) => {
if (err) {
console.log(`Stop key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
inputDeviceCooperate.stop((error) => {
if (error) {
console.log(`Stop key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Stop key mouse crossing success.`);
});
} catch (err) {
console.log(`Stop key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Stop key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -207,7 +207,7 @@ try {
stop(): Promise\<void>
停止键鼠穿越,使用Promise异步回调
停止键鼠穿越,使用Promise异步方式返回结果
**系统能力**:SystemCapability.MultimodalInput.Input.InputDeviceCooperate
......@@ -215,19 +215,19 @@ stop(): Promise\<void>
| 参数名 | 说明 |
| -------- | ---------------------------- |
| Promise\<void> | Promise实例,用于异步获取结果。 |
| Promise\<void> | Promise对象,异步返回停止键鼠穿越结果。 |
**示例**
```js
try {
inputDeviceCooperate.stop().then((err) => {
inputDeviceCooperate.stop().then(() => {
console.log(`Stop key mouse crossing success.`);
}, (err) => {
console.log(`Stop key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
}, (error) => {
console.log(`Stop key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (err) {
console.log(`Stop key mouse crossing failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Stop key mouse crossing failed. error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -235,7 +235,7 @@ try {
getState(deviceDescriptor: string, callback: AsyncCallback<{ state: boolean }>): void
获取键鼠穿越开关的状态,使用callback异步回调
获取键鼠穿越开关的状态,使用AsyncCallback异步方式返回结果
**系统能力**:SystemCapability.MultimodalInput.Input.InputDeviceCooperate
......@@ -244,21 +244,21 @@ getState(deviceDescriptor: string, callback: AsyncCallback<{ state: boolean }>):
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------- | ---- | ---------------------------- |
| deviceDescriptor | string | 是 | 键鼠穿越目标设备描述符。 |
| callback | AsyncCallback<{ state: boolean }> | 是 | 异步回调函数,接收键鼠穿越开关状态。 |
| callback | AsyncCallback<{ state: boolean }> | 是 | 回调函数,异步返回键鼠穿越开关状态。 |
**示例**
```js
try {
inputDeviceCooperate.getState(deviceDescriptor, (err, data) => {
if (err) {
console.log(`Get the status failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
inputDeviceCooperate.getState(deviceDescriptor, (error, data) => {
if (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Get the status success. data=${JSON.stringify(data)}`);
console.log(`Get the status success, data: ${JSON.stringify(data)}`);
});
} catch (err) {
console.log(`Get the status failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -266,7 +266,7 @@ try {
getState(deviceDescriptor: string): Promise<{ state: boolean }>
获取键鼠穿越开关的状态,使用Promise异步回调
获取键鼠穿越开关的状态,使用Promise异步方式返回结果
**系统能力**:SystemCapability.MultimodalInput.Input.InputDeviceCooperate
......@@ -282,7 +282,7 @@ getState(deviceDescriptor: string): Promise<{ state: boolean }>
| 参数 | 说明 |
| ------------------- | ------------------------------- |
| Promise<{ state: boolean }>| Promise实例,用于异步获取结果。 |
| Promise<{ state: boolean }>| Promise对象,异步返回键鼠穿越开关状态。 |
......@@ -291,12 +291,12 @@ getState(deviceDescriptor: string): Promise<{ state: boolean }>
```js
try {
inputDeviceCooperate.getState(deviceDescriptor).then((data) => {
console.log(`Get the status success. data=${JSON.stringify(data)}`);
}, (err) => {
console.log(`Get the status failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
console.log(`Get the status success, data: ${JSON.stringify(data)}`);
}, (error) => {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (err) {
console.log(`Get the status failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
} catch (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -312,8 +312,8 @@ on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, even
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------------------------- |
| type | string | 是 | 注册类型,'cooperation'。 |
| callback | AsyncCallback<{ deviceDescriptor: string, eventMsg: [EventMsg](#eventmsg) }> | 是 | 异步回调函数,接收键鼠穿越事件消息。 |
| type | string | 是 | 注册类型,取值”cooperation“。 |
| callback | AsyncCallback<{ deviceDescriptor: string, eventMsg: [EventMsg](#eventmsg) }> | 是 | 回调函数,异步返回键鼠穿越事件。 |
......@@ -322,14 +322,10 @@ on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, even
```js
try {
inputDeviceCooperate.on('cooperation', (data) => {
if (data) {
console.log(`error: ${JSON.stringify(data)}`);
} else {
console.log(`cooperation: ${JSON.stringify(data)}`);
}
console.log(`Key mouse crossing event: ${JSON.stringify(data)}`);
});
} catch (err) {
console.log(`Registered failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
console.log(`Registered failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......@@ -345,24 +341,37 @@ off(type: 'cooperation', callback?: AsyncCallback\<void>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------------------------- |
| type | string | 是 | 注册类型,'cooperation'。 |
| callback | AsyncCallback<void> | 否 | 异步回调函数,用于返回结果。 |
| type | string | 是 | 注册类型,取值“cooperation”。 |
| callback | AsyncCallback<void> | 否 | 需要取消注册的回调函数,若无此参数,则取消当前应用注册的所有回调函数。 |
**示例**
```js
// 取消注册单个回调函数
callback: function(event) {
console.log(`Key mouse crossing event: ${JSON.stringify(event)}`);
return false;
},
try {
inputDeviceCooperate.off('cooperation', (err) => {
if (err) {
console.log(`error: ${JSON.stringify(err)}`);
} else {
console.log(`Unregistered succeed`);
}
});
} catch (err) {
console.log(`Unregistered failed. error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
inputDeviceCooperate.on('cooperation', this.callback);
inputDeviceCooperate.off("cooperation", this.callback);
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
```js
// 取消注册所有回调函数
callback: function(event) {
console.log(`Key mouse crossing event: ${JSON.stringify(event)}`);
return false;
},
try {
inputDeviceCooperate.on('cooperation', this.callback);
inputDeviceCooperate.off("cooperation");
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
......
# 输入事件
InputEvent模块描述了设备上报的基本事件。
设备上报的基本事件。
> **说明:**
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -17,7 +17,7 @@ import InputEvent from '@ohos.multimodalInput.inputEvent';
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
| ---------- | ------ | ---- | ---- | -------------- |
| id | number | 是 | 否 | 由服务端生成全局唯一事件id |
| id | number | 是 | 否 | 事件id |
| deviceId | number | 是 | 否 | 上报输入事件的设备id |
| actionTime | number | 是 | 否 | 输入事件的上报时间 |
| screenId | number | 是 | 否 | 目标屏幕id |
......
# 键值
KeyCode模块提供了按键类设备的键值。
按键设备键值。
> **说明:**
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
......@@ -19,7 +19,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode';
| -------------------------------- | ------ | ---- | ---- | --------------------------- |
| KEYCODE_FN | number | 是 | 否 | 功能(Fn)键 |
| KEYCODE_UNKNOWN | number | 是 | 否 | 未知按键 |
| KEYCODE_HOME | number | 是 | 否 | 按键Home |
| KEYCODE_HOME | number | 是 | 否 | 功能(Home)键 |
| KEYCODE_BACK | number | 是 | 否 | 返回键 |
| KEYCODE_MEDIA_PLAY_PAUSE | number | 是 | 否 | 多媒体键 播放/暂停 |
| KEYCODE_MEDIA_STOP | number | 是 | 否 | 多媒体键 停止 |
......@@ -80,10 +80,10 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode';
| KEYCODE_Z | number | 是 | 否 | 按键'Z' |
| KEYCODE_COMMA | number | 是 | 否 | 按键',' |
| KEYCODE_PERIOD | number | 是 | 否 | 按键'.' |
| KEYCODE_ALT_LEFT | number | 是 | 否 | Alt+Left |
| KEYCODE_ALT_RIGHT | number | 是 | 否 | Alt+Right |
| KEYCODE_SHIFT_LEFT | number | 是 | 否 | Shift+Left |
| KEYCODE_SHIFT_RIGHT | number | 是 | 否 | Shift+Right |
| KEYCODE_ALT_LEFT | number | 是 | 否 | 左Alt键 |
| KEYCODE_ALT_RIGHT | number | 是 | 否 | 右Alt键 |
| KEYCODE_SHIFT_LEFT | number | 是 | 否 | 左Shift键 |
| KEYCODE_SHIFT_RIGHT | number | 是 | 否 | 右Shift键 |
| KEYCODE_TAB | number | 是 | 否 | Tab键 |
| KEYCODE_SPACE | number | 是 | 否 | 空格键 |
| KEYCODE_SYM | number | 是 | 否 | 符号修改器按键 |
......@@ -107,19 +107,19 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode';
| KEYCODE_PAGE_DOWN | number | 是 | 否 | 向下翻页键 |
| KEYCODE_ESCAPE | number | 是 | 否 | ESC键 |
| KEYCODE_FORWARD_DEL | number | 是 | 否 | 删除键 |
| KEYCODE_CTRL_LEFT | number | 是 | 否 | Control+Left |
| KEYCODE_CTRL_RIGHT | number | 是 | 否 | Control+Right |
| KEYCODE_CTRL_LEFT | number | 是 | 否 | 左Ctrl键 |
| KEYCODE_CTRL_RIGHT | number | 是 | 否 | 右Ctrl键 |
| KEYCODE_CAPS_LOCK | number | 是 | 否 | 大写锁定键 |
| KEYCODE_SCROLL_LOCK | number | 是 | 否 | 滚动锁定键 |
| KEYCODE_META_LEFT | number | 是 | 否 | 左元修改器键 |
| KEYCODE_META_RIGHT | number | 是 | 否 | 右元修改器键 |
| KEYCODE_FUNCTION | number | 是 | 否 | 函数修改器键 |
| KEYCODE_FUNCTION | number | 是 | 否 | 功能键 |
| KEYCODE_SYSRQ | number | 是 | 否 | 系统请求/打印屏幕键 |
| KEYCODE_BREAK | number | 是 | 否 | Break/Pause键 |
| KEYCODE_MOVE_HOME | number | 是 | 否 | 光标移动到开始键 |
| KEYCODE_MOVE_END | number | 是 | 否 | 光标移动到末尾键 |
| KEYCODE_INSERT | number | 是 | 否 | 插入键 |
| KEYCODE_FORWARD | number | 是 | 否 | 删除键 |
| KEYCODE_FORWARD | number | 是 | 否 | 前进键 |
| KEYCODE_MEDIA_PLAY | number | 是 | 否 | 多媒体键 播放 |
| KEYCODE_MEDIA_PAUSE | number | 是 | 否 | 多媒体键 暂停 |
| KEYCODE_MEDIA_CLOSE | number | 是 | 否 | 多媒体键 关闭 |
......
# 按键输入事件
KeyEvent模块提供了设备可以上报的按键事件。
设备上报的按键事件。
> **说明:**
>
......@@ -18,9 +18,9 @@ import {Action, Key, KeyEvent} from '@ohos.multimodalInput.keyEvent';
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
| ------ | -------- | ---- | ---- | -------- |
| CANCEL | number | 是 | 否 | 取消按钮 |
| DOWN | number | 是 | 否 | 按下按钮 |
| UP | number | 是 | 否 | 抬起按钮 |
| CANCEL | number | 是 | 否 | 按键取消 |
| DOWN | number | 是 | 否 | 按键按下 |
| UP | number | 是 | 否 | 按键抬起 |
## Key
......@@ -29,8 +29,8 @@ import {Action, Key, KeyEvent} from '@ohos.multimodalInput.keyEvent';
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
| ----------- | -------- | ---- | ---- | -------------- |
| code | KeyCode | 是 | 否 | 按键码 |
| pressedTime | number | 是 | 否 | 按下持续的时间 |
| deviceId | number | 是 | 否 | 按键所属设备 |
| pressedTime | number | 是 | 否 | 按键按下时间 |
| deviceId | number | 是 | 否 | 按键所属设备id |
## KeyEvent
......@@ -39,7 +39,7 @@ import {Action, Key, KeyEvent} from '@ohos.multimodalInput.keyEvent';
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
| ----------- | -------- | ---- | ---- | ------------------------------ |
| action | Action | 是 | 否 | 按键动作 |
| key | Key | 是 | 否 | 当前发生变化的按键 |
| key | Key | 是 | 否 | 当前上报的按键 |
| unicodeChar | number | 是 | 否 | 按键对应的uniCode字符 |
| keys | Key[] | 是 | 否 | 当前处于按下状态的按键列表 |
| ctrlKey | boolean | 是 | 否 | 当前ctrlKey是否处于按下状态 |
......
......@@ -17,13 +17,13 @@ import {Action,Button,Axis,AxisValue,MouseEvent} from '@ohos.multimodalInput.mou
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
| ----------- | -------- | ---- | ---- | -------------------- |
| CANCEL | number | 是 | 否 | 取消动作 |
| CANCEL | number | 是 | 否 | 取消 |
| MOVE | number | 是 | 否 | 鼠标移动 |
| BUTTON_DOWN | number | 是 | 否 | 鼠标按钮按下 |
| BUTTON_UP | number | 是 | 否 | 鼠标按钮抬起 |
| AXIS_BEGIN | number | 是 | 否 | 鼠标关联的轴事件开始 |
| AXIS_UPDATE | number | 是 | 否 | 鼠标关联的轴事件更新 |
| AXIS_END | number | 是 | 否 | 鼠标关联的轴事件结束 |
| AXIS_BEGIN | number | 是 | 否 | 鼠标轴事件开始 |
| AXIS_UPDATE | number | 是 | 否 | 鼠标轴事件更新 |
| AXIS_END | number | 是 | 否 | 鼠标轴事件结束 |
## Button
......@@ -69,14 +69,14 @@ import {Action,Button,Axis,AxisValue,MouseEvent} from '@ohos.multimodalInput.mou
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
| -------------- | ----------- | ---- | ---- | ---------------------------------------- |
| action | Action | 是 | 否 | 鼠标事件动作 |
| screenX | number | 是 | 否 | 鼠标光标在屏幕中的x坐标 |
| screenY | number | 是 | 否 | 鼠标光标在屏幕中的y坐标 |
| windowX | number | 是 | 否 | 鼠标归属窗口的x坐标 |
| windowY | number | 是 | 否 | 鼠标归属窗口的y坐标 |
| rawDeltaX | number | 是 | 否 | X轴相对上次上报鼠标位置的偏移,在屏幕边缘位置时,该值可能小于两次鼠标上报的坐标差 |
| rawDeltaY | number | 是 | 否 | Y轴相对上次上报鼠标位置的偏移 |
| button | Button | 是 | 否 | 当前按下/抬起的按钮 |
| pressedButtons | Button[] | 是 | 否 | 当前处于按下状态的按钮 |
| screenX | number | 是 | 否 | 鼠标光标在屏幕中的坐标 |
| screenY | number | 是 | 否 | 鼠标光标在屏幕中的坐标 |
| windowX | number | 是 | 否 | 鼠标所在窗口的横坐标 |
| windowY | number | 是 | 否 | 鼠标所在窗口的纵坐标 |
| rawDeltaX | number | 是 | 否 | 鼠标本次操作横坐标偏移值 |
| rawDeltaY | number | 是 | 否 | 鼠标本次操作纵坐标偏移值 |
| button | Button | 是 | 否 | 鼠标按钮
| pressedButtons | Button[] | 是 | 否 | 当前处于按下状态的鼠标按钮 |
| axes | AxisValue[] | 是 | 否 | 事件包含的所有轴数据 |
| pressedKeys | KeyCode[] | 是 | 否 | 当前处于按下状态的按键列表 |
| ctrlKey | boolean | 是 | 否 | 当前ctrlKey是否处于按下状态 |
......
......@@ -54,19 +54,19 @@ import {Action,ToolType,SourceType,Touch,TouchEvent} from '@ohos.multimodalInput
| 名称 | 参数类型 | 可读 | 可写 | 描述 |
| ----------- | ------ | ---- | ---- | ----------------------------------- |
| id | number | 是 | 否 | 指针标识 |
| pressedTime | number | 是 | 否 | 按下时的时间戳 |
| id | number | 是 | 否 | 触摸事件标识 |
| pressedTime | number | 是 | 否 | 按下时间戳 |
| screenX | number | 是 | 否 | 触摸位置所属的屏幕x坐标 |
| screenY | number | 是 | 否 | 触摸位置所属的屏幕y坐标 |
| windowX | number | 是 | 否 | 触摸位置在窗口中的x坐标 |
| windowY | number | 是 | 否 | 触摸位置在窗口中的y坐标 |
| pressure | number | 是 | 否 | 压力值,取值范围是[0.0, 1.0], 0.0表示不支持 |
| width | number | 是 | 否 | 按下接触区域的宽度 |
| height | number | 是 | 否 | 按下接触区域的高度 |
| width | number | 是 | 否 | 触摸区域的宽度 |
| height | number | 是 | 否 | 触摸区域的高度 |
| tiltX | number | 是 | 否 | 相对YZ平面的角度,取值的范围[-90, 90],其中正值是向右倾斜。 |
| tiltY | number | 是 | 否 | 相对XZ平面的角度,值的范围[-90, 90],其中正值是向下倾斜。 |
| toolX | number | 是 | 否 | 工具区域的中心点X |
| toolY | number | 是 | 否 | 工具区域的中心点Y |
| toolX | number | 是 | 否 | 工具区域的中心点x坐标 |
| toolY | number | 是 | 否 | 工具区域的中心点y坐标 |
| toolWidth | number | 是 | 否 | 工具区域宽度 |
| toolHeight | number | 是 | 否 | 工具区域高度 |
| rawX | number | 是 | 否 | 输入设备上的x坐标 |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册