Skip to content

Mouse keyboard adaptation#18656

Merged
dumganhar merged 5 commits into
cocos:v3.8.7from
wanghui187:v3.8.7
Apr 29, 2025
Merged

Mouse keyboard adaptation#18656
dumganhar merged 5 commits into
cocos:v3.8.7from
wanghui187:v3.8.7

Conversation

@wanghui187

Copy link
Copy Markdown
Contributor

Re: #

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

Signed-off-by: @wanghui187 <348582973@qq.com>
@github-actions

github-actions Bot commented Apr 24, 2025

Copy link
Copy Markdown

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1005779 bytes 1005779 bytes ✅ 0 bytes
2D All (legacy pipeline) 2669527 bytes 2669527 bytes ✅ 0 bytes
2D All (new pipeline) 2758034 bytes 2758034 bytes ✅ 0 bytes
(2D + 3D) All 10013918 bytes 10013918 bytes ✅ 0 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16829288 bytes 16829288 bytes ✅ 0 bytes

Interface Check Report

This pull request does not change any public interfaces !

Signed-off-by: @wanghui187 <348582973@qq.com>
@qiuguohua
qiuguohua requested review from dumganhar and qiuguohua and removed request for qiuguohua April 24, 2025 01:11
Comment thread native/cocos/platform/openharmony/OpenHarmonyPlatform.cpp Outdated
Comment thread native/cocos/platform/openharmony/OpenHarmonyPlatform.h Outdated
Comment thread native/cocos/platform/openharmony/OpenHarmonyPlatform.h Outdated
Signed-off-by: @wanghui187 <348582973@qq.com>
Comment thread native/cocos/bindings/manual/jsb_global.cpp Outdated
ev->key = ohKeyCodeToCocosKeyCode(code);
sendMsgToWorker(cc::MessageType::WM_XCOMPONENT_KEY_EVENT, reinterpret_cast<void*>(ev), window);
} else {
DO_CC_LOG_ERROR("OpenHarmonyPlatform::getKeyEventError");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use CC_LOG_ERROR?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

ev->type = cc::MouseEvent::Type::UNKNOWN;
break;
}
if(ev->type == cc::MouseEvent::Type::UNKNOWN) return;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it returns here, ‘ev’ is not released?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

}
}

onMouseWheel(eventType: string,event: PanGestureEvent) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onMouseWheel(eventType: string,event: PanGestureEvent) {
onMouseWheel(eventType: string, event: PanGestureEvent) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

resourceManagerInit: (resourceManager: resourceManager.ResourceManager) => void;
writablePathInit: (cacheDir: string) => void;
onVideoEvent: (param: string) => void;
onMouseWheel: (type: string, offsetY:number) => void;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onMouseWheel: (type: string, offsetY:number) => void;
onMouseWheel: (type: string, offsetY: number) => void;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

let matchStandardFactor = 0;
if (systemInfo.os === OS.OPENHARMONY) {
matchStandardFactor = 5;
eventMouse.setScrollData(mouseEvent.wheelDeltaX, mouseEvent.wheelDeltaY * matchStandardFactor);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we annotate why there is such a difference?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to actual measurements, this coefficient is suitable

Signed-off-by: @wanghui187 <348582973@qq.com>
@dumganhar
dumganhar requested a review from qiuguohua April 29, 2025 06:43
Signed-off-by: @wanghui187 <348582973@qq.com>
@dumganhar
dumganhar merged commit a1243b4 into cocos:v3.8.7 Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants