Skip to content
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

修正 "横着拿iPad 玩竖屏微信小游戏" 时, safeArea错误的问题. #224

Merged
merged 1 commit into from Mar 1, 2021

Conversation

finscn
Copy link
Contributor

@finscn finscn commented Feb 9, 2021

其他 小游戏平台, 以及其他 pad 没有测试 和 修改. 请 cocos官方去验证核实一下吧.

主要原因是. 微信小游戏上 不能用 windowWidth/windowHeight 来判断是不是landscape , 要用 screenWidth/screenHeight .

其他 小游戏平台,  以及其他 pad 没有测试 和 修改. 请 cocos官方去验证核实一下吧.

主要原因是.  微信小游戏上 不能用  windowWidth/windowHeight 来判断是不是landscape , 要用 screenWidth/screenHeight .
@finscn
Copy link
Contributor Author

finscn commented Feb 9, 2021

image
补充一张图:

screen是 红框.
window 是绿框.

@finscn
Copy link
Contributor Author

finscn commented Feb 9, 2021

加 "orientation ? (orientation === "landscape")" 这个 是因为有的版本微信 没有这个属性.

@holycanvas holycanvas changed the base branch from master to v2.4.5 February 22, 2021 02:34
@PPpro
Copy link
Collaborator

PPpro commented Feb 25, 2021

setInterval(() => {
  
  let sys = wx.getSystemInfoSync();
  console.warn('pptest', sys.windowWidth,  sys.windowHeight);
  console.warn('pptest2', sys.screenWidth,  sys.screenHeight);

}, 1000);

2

这边在 ipad mini 5 上验证了一下, 数值上看起来是一样的
在 iPad 上预期正确的行为是,横屏情况下画布拉满 屏幕吗

应该不是安全区域的问题。试试修改下 game.json 的配置呢 , 把 resizable 开起来,参考 https://developers.weixin.qq.com/minigame/dev/reference/configuration/app.html

{
    "deviceOrientation": "portrait",
    "resizable": true 
}

@finscn
Copy link
Contributor Author

finscn commented Feb 25, 2021

1 "在 iPad 上预期正确的行为是,横屏情况下画布拉满 屏幕吗"
不是, 就应该是像你截图立这样, 两边是黑色的 没问题.

2 我没设置 resizable. 也不能设置.有些东西会乱掉

3 我这边log 是不一样的.

@finscn
Copy link
Contributor Author

finscn commented Feb 25, 2021

我说的 safeArea 不是指微信的safeArea .
而是 cocos计算safeArea 时 用的方式不对

@PPpro PPpro merged commit 385d38d into cocos-creator-packages:v2.4.5 Mar 1, 2021
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.

None yet

2 participants