Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2c594f5c
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2c594f5c
编写于
6月 20, 2023
作者:
X
xixian_2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mmi_multiFingers_gesture_Docs
Signed-off-by:xixian_2023<xixian@huawei.com>
上级
b410869c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
300 addition
and
0 deletion
+300
-0
zh-cn/application-dev/reference/apis/Readme-CN.md
zh-cn/application-dev/reference/apis/Readme-CN.md
+1
-0
zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md
zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md
+237
-0
zh-cn/application-dev/reference/apis/js-apis-multimodalinput-gestureevent.md
...ev/reference/apis/js-apis-multimodalinput-gestureevent.md
+62
-0
未找到文件。
zh-cn/application-dev/reference/apis/Readme-CN.md
浏览文件 @
2c594f5c
...
...
@@ -369,6 +369,7 @@
-
[
@ohos.deviceInfo (设备信息)
](
js-apis-device-info.md
)
-
[
@ohos.distributedHardware.deviceManager (设备管理)
](
js-apis-device-manager.md
)
-
[
@ohos.geoLocationManager (位置服务)
](
js-apis-geoLocationManager.md
)
-
[
@ohos.multimodalInput.gestureEvent (手势事件)
](
js-apis-multimodalinput-gestureevent.md
)
-
[
@ohos.multimodalInput.inputConsumer (组合按键)
](
js-apis-inputconsumer.md
)
-
[
@ohos.multimodalInput.inputDevice (输入设备)
](
js-apis-inputdevice.md
)
-
[
@ohos.multimodalInput.inputDeviceCooperate (键鼠穿越)(待停用)
](
js-apis-cooperate.md
)
...
...
zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md
浏览文件 @
2c594f5c
...
...
@@ -211,3 +211,240 @@ try {
console
.
log
(
`Monitor on failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
## inputMonitor.on(pinch)<sup>10+</sup>
on(type: "pinch", receiver: Callback
<
[Pinch](js-apis-multimodalinput-gestureevent.md/#pinch)
>
): void
开始监听全局触控板捏合事件。
**需要权限:**
ohos.permission.INPUT_MONITORING
**系统能力:**
SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------- |
| type | string | 是 | 输入设备事件类型,取值“pinch”。 |
| receiver | Callback
<
[Pinch](js-apis-multimodalinput-gestureevent.md/#pinch)
>
| 是 | 回调函数,异步上报捏合输入事件。 |
**示例:**
```
js
try
{
inputMonitor
.
on
(
"
pinch
"
,
(
pinchEvent
)
=>
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
pinchEvent
)}
`
);
return
false
;
});
}
catch
(
error
)
{
console
.
log
(
`Monitor on failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
## inputMonitor.off(pinch)<sup>10+</sup>
off(type: "pinch", receiver?: Callback
<
[Pinch](js-apis-multimodalinput-gestureevent.md/#pinch)
>
): void
停止监听全局触控板捏合事件。
**需要权限:**
ohos.permission.INPUT_MONITORING
**系统能力:**
SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------- |
| type | string | 是 | 输入设备事件类型,取值“pinch”。 |
| receiver | Callback
<
[Pinch](js-apis-multimodalinput-gestureevent.md/#pinch)
>
| 否 | 需要取消监听的回调函数,若无此参数,则取消当前应用监听的所有回调函数。 |
**示例:**
```
js
// 取消监听单个回调函数
function
callback
(
pinchEvent
)
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
pinchEvent
)}
`
);
return
false
;
};
try
{
inputMonitor
.
on
(
"
pinch
"
,
callback
);
inputMonitor
.
off
(
"
pinch
"
,
callback
);
console
.
log
(
`Monitor off success`
);
}
catch
(
error
)
{
console
.
log
(
`Monitor execute failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
```
js
// 取消监听所有回调函数
function
callback
(
pinchEvent
)
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
pinchEvent
)}
`
);
return
false
;
};
try
{
inputMonitor
.
on
(
"
pinch
"
,
callback
);
inputMonitor
.
off
(
"
pinch
"
);
console
.
log
(
`Monitor off success`
);
}
catch
(
error
)
{
console
.
log
(
`Monitor execute failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
## inputMonitor.on(threeFingersSwipe)<sup>10+</sup>
on(type: "threeFingersSwipe", receiver: Callback
<
[ThreeFingersSwipe](js-apis-multimodalinput-gestureevent.md/#threefingersswipe)
>
): void
开始监听全局触控板三指滑动事件。
**需要权限:**
ohos.permission.INPUT_MONITORING
**系统能力:**
SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------- |
| type | string | 是 | 输入设备事件类型,取值“threeFingersSwipe”。 |
| receiver | Callback
<
[ThreeFingersSwipe](js-apis-multimodalinput-gestureevent.md/#threefingersswipe)
>
| 是 | 回调函数,异步上报三指滑动输入事件。 |
**示例:**
```
js
try
{
inputMonitor
.
on
(
"
threeFingersSwipe
"
,
(
threeFingersSwipe
)
=>
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
threeFingersSwipe
)}
`
);
return
false
;
});
}
catch
(
error
)
{
console
.
log
(
`Monitor on failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
## inputMonitor.off(threeFingersSwipe)<sup>10+</sup>
off(type: "threeFingersSwipe", receiver?: Callback
<
[ThreeFingersSwipe](js-apis-multimodalinput-gestureevent.md/#threefingersswipe)
>
): void
停止监听全局触控板三指滑动事件。
**需要权限:**
ohos.permission.INPUT_MONITORING
**系统能力:**
SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------- |
| type | string | 是 | 输入设备事件类型,取值“threeFingersSwipe”。 |
| receiver | Callback
<
[ThreeFingersSwipe](js-apis-multimodalinput-gestureevent.md/#threefingersswipe)
>
| 否 | 需要取消监听的回调函数,若无此参数,则取消当前应用监听的所有回调函数。 |
**示例:**
```
js
// 取消监听单个回调函数
function
callback
(
threeFingersSwipe
)
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
threeFingersSwipe
)}
`
);
return
false
;
};
try
{
inputMonitor
.
on
(
"
threeFingersSwipe
"
,
callback
);
inputMonitor
.
off
(
"
threeFingersSwipe
"
,
callback
);
console
.
log
(
`Monitor off success`
);
}
catch
(
error
)
{
console
.
log
(
`Monitor execute failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
```
js
// 取消监听所有回调函数
function
callback
(
threeFingersSwipe
)
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
threeFingersSwipe
)}
`
);
return
false
;
};
try
{
inputMonitor
.
on
(
"
threeFingersSwipe
"
,
callback
);
inputMonitor
.
off
(
"
threeFingersSwipe
"
);
console
.
log
(
`Monitor off success`
);
}
catch
(
error
)
{
console
.
log
(
`Monitor execute failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
## inputMonitor.on(fourFingersSwipe)<sup>10+</sup>
on(type: "fourFingersSwipe", receiver: Callback
<
[FourFingersSwipe](js-apis-multimodalinput-gestureevent.md/#fourfingersswipe)
>
): void
开始监听全局触控板四指滑动事件。
**需要权限:**
ohos.permission.INPUT_MONITORING
**系统能力:**
SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------- |
| type | string | 是 | 输入设备事件类型,取值“fourFingersSwipe”。 |
| receiver | Callback
<
[FourFingersSwipe](js-apis-multimodalinput-gestureevent.md/#fourfingersswipe)
>
| 是 | 回调函数,异步上报四指滑动输入事件。 |
**示例:**
```
js
try
{
inputMonitor
.
on
(
"
fourFingersSwipe
"
,
(
fourFingersSwipe
)
=>
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
fourFingersSwipe
)}
`
);
return
false
;
});
}
catch
(
error
)
{
console
.
log
(
`Monitor on failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
## inputMonitor.off(fourFingersSwipe)<sup>10+</sup>
off(type: "fourFingersSwipe", receiver?: Callback
<
[FourFingersSwipe](js-apis-multimodalinput-gestureevent.md/#fourfingersswipe)
>
): void
停止监听全局触控板四指滑动事件。
**需要权限:**
ohos.permission.INPUT_MONITORING
**系统能力:**
SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------- |
| type | string | 是 | 输入设备事件类型,取值“fourFingersSwipe”。 |
| receiver | Callback
<
[FourFingersSwipe](js-apis-multimodalinput-gestureevent.md/#fourfingersswipe)
>
| 否 | 需要取消监听的回调函数,若无此参数,则取消当前应用监听的所有回调函数。 |
**示例:**
```
js
// 取消监听单个回调函数
function
callback
(
fourFingersSwipe
)
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
fourFingersSwipe
)}
`
);
return
false
;
};
try
{
inputMonitor
.
on
(
"
fourFingersSwipe
"
,
callback
);
inputMonitor
.
off
(
"
fourFingersSwipe
"
,
callback
);
console
.
log
(
`Monitor off success`
);
}
catch
(
error
)
{
console
.
log
(
`Monitor execute failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
```
js
// 取消监听所有回调函数
function
callback
(
fourFingersSwipe
)
{
console
.
log
(
`Monitor on success
${
JSON
.
stringify
(
fourFingersSwipe
)}
`
);
return
false
;
};
try
{
inputMonitor
.
on
(
"
fourFingersSwipe
"
,
callback
);
inputMonitor
.
off
(
"
fourFingersSwipe
"
);
console
.
log
(
`Monitor off success`
);
}
catch
(
error
)
{
console
.
log
(
`Monitor execute failed, error:
${
JSON
.
stringify
(
error
,
[
`code`
,
`message`
])}
`
);
}
```
zh-cn/application-dev/reference/apis/js-apis-multimodalinput-gestureevent.md
0 → 100644
浏览文件 @
2c594f5c
# @ohos.multimodalInput.gestureEvent (手势输入事件)
设备上报的手势事件。
> **说明:**
>
> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
```
js
import
{
Pinch
,
ThreeFingersSwipe
,
FourFingersSwipe
,
ActionType
}
from
'
@ohos.multimodalInput.gestureEvent
'
;
```
## Pinch
捏合事件。
**系统能力**
:SystemCapability.MultimodalInput.Input.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ----------- | ---- | ---- | ---------------------------------------- |
| type |
[
ActionType
](
#actiontype
)
| 是 | 否 | 捏合事件类型 |
| scale | number | 是 | 否 | 捏合度 |
## ThreeFingersSwipe
三指滑动事件。
**系统能力**
:SystemCapability.MultimodalInput.Input.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ----------- | ---- | ---- | ---------------------------------------- |
| type |
[
ActionType
](
#actiontype
)
| 是 | 否 | 三指滑动事件类型 |
| x | number | 是 | 否 | 坐标x |
| y | number | 是 | 否 | 坐标y |
## FourFingersSwipe
四指滑动事件。
**系统能力**
:SystemCapability.MultimodalInput.Input.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------------- | ----------- | ---- | ---- | ---------------------------------------- |
| type |
[
ActionType
](
#actiontype
)
| 是 | 否 | 四指滑动事件类型 |
| x | number | 是 | 否 | 坐标x |
| y | number | 是 | 否 | 坐标y |
## ActionType
手势事件类型。
**系统能力**
:SystemCapability.MultimodalInput.Input.Core
| 名称 | 值 | 说明 |
| ----------- | --- | --------------- |
| CANCEL | 0 | 取消 |
| BEGIN | 1 | 手势开始 |
| UPDATE | 2 | 手势更新 |
| END | 3 | 手势结束 |
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录