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 video player and webview transform #5684
Conversation
@@ -440,18 +440,17 @@ let VideoPlayerImpl = cc.Class({ | |||
}, | |||
|
|||
updateMatrix (node) { | |||
if (!this._video || !this._visible || this._fullScreenEnabled) return; | |||
if (!this._video || !this._visible || this._fullScreenEnabled || !this._forceUpdate) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不对吧,你这不是只有 _forceUpdate 才会更新了。
如果只是 position 改变了,没必要调用 _forceUpdate 吧
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -58,7 +58,6 @@ let VideoPlayerImpl = cc.Class({ | |||
this._ignorePause = false; | |||
|
|||
// update matrix cache | |||
this._forceUpdate = true; | |||
this._m00 = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
看了一下代码发现,在隐藏 videoplayer 的时,updateMatrix 是不会执行的,所以没必要设置该属性,进行移除
scaleX /= dpr; | ||
scaleY /= dpr; | ||
let scaleX = 1 / dpr; | ||
let scaleY = 1 / dpr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可能还是要用 let scaleX = cc.view._scaleX / dpr
不同 canvas 适配模式,可能 scaleY scaleX 不一定为 1
@@ -496,9 +490,6 @@ let VideoPlayerImpl = cc.Class({ | |||
let appx = (w * _mat4_tempm[0]) * node._anchorPoint.x; | |||
let appy = (h * _mat4_tempm[5]) * node._anchorPoint.y; | |||
|
|||
let viewport = cc.view._viewportRect; | |||
offsetX += viewport.x / dpr; | |||
offsetY += viewport.y / dpr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果 canvas 组件是其他适配模式的话,可能还是得考虑 viewport 的偏移量
scaleX /= dpr; | ||
scaleY /= dpr; | ||
let scaleX = 1 / dpr; | ||
let scaleY = 1 / dpr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
let appx = (w * _mat4_tempm[0]) * node._anchorPoint.x; | ||
let appy = (h * _mat4_tempm[5]) * node._anchorPoint.y; | ||
|
||
let viewport = cc.view._viewportRect; | ||
offsetX += viewport.x / dpr; | ||
offsetY += viewport.y / dpr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
已经在 camera 变换里计算了 scale 和 viewport 偏移,那就没问题了 |
Re: cocos-creator/2d-tasks#2050 cocos-creator/2d-tasks#2053
Changes: