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

fixed Issues #2109 #5863

Merged
merged 4 commits into from Dec 12, 2019
Merged

fixed Issues #2109 #5863

merged 4 commits into from Dec 12, 2019

Conversation

zhefengzhang
Copy link
Contributor

@zhefengzhang zhefengzhang commented Dec 7, 2019

将原先 2.2.1-release 上的 PR 提交到 2.3.0 。
RE:cocos/2d-tasks#2109

@holycanvas
Copy link
Contributor

holycanvas commented Dec 9, 2019

webkitRequestFullScreen、webkitfullscreenchange、webkitfullscreenerror

如果uc上不支持上面几个接口,那支不支持requestfullscreen, fullscreenchange, fullscreenerror, 得先确认下这个,因为uc不太可能不支持全屏,不然早就被喷了,应该只是名字不一定是webkit开头的。

尽量从根源来解决问题,保护代码只在确实需要的时候做

@zhefengzhang
Copy link
Contributor Author

zhefengzhang commented Dec 9, 2019

不支持 requestfullscreen, fullscreenchange, fullscreenerror。
UC 浏览器在全屏模式下 document 支持下方三个属性,其余的没有。

webkitCancelFullScreen、webkitIsFullScreen、webkitCurrentFullScreenElement

ccScreen 的 requestFullScreen 代码中,通过 this._supportsFullScreen 来判断是否支持 requestFullscreen,在 UC 上出现了漏洞。因为 init 中初始化 document 对象属性列表时,document[val[1]] 是有值的,也就是 webkitCancelFullScreen。

this._supportsFullScreen = void 0 !== this._fn.requestFullscreen;

现在修改为

this._supportsFullScreen = (this._fn.requestFullscreen !== undefined && document[this._fn.requestFullscreen]);

@holycanvas
Copy link
Contributor

holycanvas commented Dec 10, 2019

那直接在上面init的地方加强一下判断会比较好

if (val && (typeof document[val[1]] !== 'undefined') &&  (typeof document[val[0]] !== 'undefined')) {

@holycanvas holycanvas requested review from knoxHuang and PPpro Dec 12, 2019
@PPpro
Copy link
Contributor

PPpro commented Dec 12, 2019

按 issue cocos/2d-tasks#2109 的描述
UC 应该是支持全屏的,这样改了之后,会导致 UC 不支持全屏了吗

@zhefengzhang
Copy link
Contributor Author

zhefengzhang commented Dec 12, 2019

这样修改之后 UC 浏览器依旧可以使用全屏功能。这里加强的是 init 函数的过滤条件,并不会导致原先的功能失效。

@holycanvas
Copy link
Contributor

holycanvas commented Dec 12, 2019

这样改了之后能解决无法缩放的问题?

@zhefengzhang
Copy link
Contributor Author

zhefengzhang commented Dec 12, 2019

我在真机上测试过,能解决。

@holycanvas holycanvas requested a review from jareguo Dec 12, 2019
@holycanvas holycanvas merged commit 9f00990 into cocos:v2.3.0 Dec 12, 2019
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

5 participants