8000 fix bug about orientation & safeArea ( CCView.js ) by finscn · Pull Request #16714 · cocos/cocos-engine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix bug about orientation & safeArea ( CCView.js ) #16714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

finscn
Copy link
Contributor
@finscn finscn commented Jan 31, 2024

旋转时应强制执行 resizeEvent.

快速旋转180度时, frame/ view没有发生变化, 但是 刘海 挖孔位置反转, 需要刷新 safeArea 和 widget组件

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.

旋转时应强制执行 resizeEvent.

快速旋转180度时, frame/ view没有发生变化, 但是 刘海 挖空位置反转 需要更新 safeArea.
@finscn
Copy link
Contributor Author
finscn commented Mar 17, 2024

@minggo @VisualSJ 这个麻烦看下

@minggo minggo requested a review from bofeng-song March 18, 2024 01:30
@minggo
Copy link
Contributor
minggo commented Mar 18, 2024

已经在处理 orientation 的问题了。orientation 和 resize 会分开处理。
@bofeng-song 看一下这个 PR。

@bofeng-song
Copy link
Contributor

@finscn
#16774
这个pr增加了 orientation-change事件派发,外部可以监听具体的事件

如:
import {screen, macro} from 'cc'
screen.on('orientation-change', listener);

@@ -209,7 +209,7 @@ cc.js.mixin(View.prototype, {

_orientationChange: function () {
cc.view._orientationChanging = true;
cc.view._resizeEvent();
cc.view._resizeEvent(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

you can cherry repick code from #16774
and follow this PR-test-case

Copy link
Contributor

Choose a reason for hiding this comment

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

you can cherry repick code from #16774 and follow this PR-test-case

@finscn 不好意思,一直以为是3.x的代码,2.x不能直接用。3.x的类似逻辑未同步到2.x前,可以按照你的方式修改。

@finscn
Copy link
Contributor Author
finscn commented Mar 24, 2024

@finscn #16774 这个pr增加了 orientation-change事件派发,外部可以监听具体的事件

如: import {screen, macro} from 'cc' screen.on('orientation-change', listener);

我没太明白啥意思.
SafeArea 组件是cocos内部的组件,
难道要让开发者自己去监听 orientation-change事件 , 自己去处理 SafeArea?

我这个PR 要解决的核心问题 不是 "我监听不到 orientation-change事件".
而是 快速旋转屏幕 180度时, cocos自带的 safeArea 数据错误.
你告诉我 "外部可以监听具体的事件" 和 "修正 safeArea 数据错误" 之间没啥关系吧

@minggo minggo merged commit caf35a7 into cocos:v2.4.13 Mar 25, 2024
knoxHuang pushed a commit to knoxHuang/engine-2 that referenced this pull request Apr 26, 2024
Should force trigger resize event when the orientation changed.
minggo added a commit that referenced this pull request Apr 26, 2024
fix bug about orientation & safeArea ( CCView.js ) (#16714)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
46BA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0