openharmony 鸿蒙 changelogs-multimodalinput

2025-06-16 浏览 (1)

multimodalinput子系统ChangeLog

cl.multimodalinput.1 inputMonitor接口实现错误修正

多模输入inputMonitor接口中针对TouchEvent的监听接口,callback中TouchEvent原先引用arkui-js的通用事件TouchEvent,但该接口没有对外暴露(即未export),IDE中默认TouchEvent为arkui-ts中的TouchEvent,ArtTS语法整改之后,原接口失效。因此需要将inputMointor中的TouchEvent引用修改为多模输入的TouchEvent。

变更影响

字段名变更,原有的字段获取的值为undefine

关键的接口/组件变更

使用inputMonitor监听多模输入TouchEvent时,需要单独import多模的touchEvent类

import touchEvent from '@ohos.multimodalInput.touchEvent';
try {
  inputMonitor.on('touch', (touchEvent: touchEvent.TouchEvent) => {
    console.log(`Monitor on success ${JSON.stringify(touchEvent)}`);
    return false;
  });
} catch (error) {
  console.log(`Monitor on failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}

适配指导

OpenHarmony4.0.11.5之后需要应用将字段修改为多模的TouchEvent字段名

变更前变更后
typeaction
timestampactionTime
deviceIddeviceId
globalXscreenX
globalYscreenY
localXwindowX
localYwindowY
forcepressure
touchestouches
changedTouchestouches

你可能感兴趣的鸿蒙文章

harmony 鸿蒙分布式数据管理子系统ChangeLog

harmony 鸿蒙文件管理子系统ChangeLog

harmony 鸿蒙multimedia子系统ChangeLog

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/v6755v