openharmony 鸿蒙 changelogs-multimodalinput

2025-06-12 浏览 (1)

Multimodal Input Subsystem Changelog

cl.multimodalinput.1 Implementation Error of inputMonitor Corrected

When inputMonitor is used to listen for TouchEvent, TouchEvent in the callback originally references the common TouchEvent of arkui-js, which is not exposed externally (that is, not exported). However, TouchEvent of arkui-ts is used by default in IDE. Therefore, the original API becomes invalid after the ArtTS syntax update. To solve this problem, you need to change the TouchEvent reference in inputMonitor to TouchEvent of the multimodal input.

Change Impact

The field name is changed. The value of the original field is undefined.

Key API/Component Changes

If you want to use inputMonitor to listen for TouchEvent of the multimodal input, you need to import the touchEvent class of the multimodal input separately.

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`])}`);
}

Adaptation Guide

Since OpenHarmony 4.0.11.5, change the field names of TouchEvent to those of the multimodal input.

Before ChangeAfter Change
typeaction
timestampactionTime
deviceIddeviceId
globalXscreenX
globalYscreenY
localXwindowX
localYwindowY
forcepressure
touchestouches
changedTouchestouches

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Distributed Data Management Subsystem Changelog

harmony 鸿蒙File Management Subsystem Changelog

harmony 鸿蒙Multimedia Subsystem Changelog

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