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

cache viewport when updating editBox matrix #6347

Merged
merged 3 commits into from Mar 17, 2020

Conversation

PPpro
Copy link
Contributor

@PPpro PPpro commented Mar 17, 2020

Re: #6319

changelog:

  • 修复 web 平台屏幕 resize 之后,editBox 输入框显示错位的问题

@PPpro PPpro requested a review from holycanvas Mar 17, 2020
// check whether need to update
if (this._m00 === worldMatm[0] && this._m01 === worldMatm[1] &&
this._m04 === worldMatm[4] && this._m05 === worldMatm[5] &&
this._m12 === worldMatm[12] && this._m13 === worldMatm[13] &&
this._w === node._contentSize.width && this._h === node._contentSize.height) {
this._w === node._contentSize.width && this._h === node._contentSize.height &&
this._viewportRectX === localView._viewportRect.x &&
Copy link
Contributor

@holycanvas holycanvas Mar 17, 2020

Choose a reason for hiding this comment

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

定义一个 Rect 变量?这样不用缓存四个,比较的时候直接用 Rect.equals 来比

Copy link
Contributor Author

@PPpro PPpro Mar 17, 2020

Choose a reason for hiding this comment

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

已经更新

@@ -320,10 +323,15 @@ Object.assign(WebEditBoxImpl.prototype, {
this._m13 = worldMatm[13];
this._w = node._contentSize.width;
this._h = node._contentSize.height;
// update viewport cache
this._cacheViewportRect.x = localView._viewportRect.x;
Copy link
Contributor

@holycanvas holycanvas Mar 17, 2020

Choose a reason for hiding this comment

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

应该用 this._cacheViewportRect.set(localView._viewportRect) 就行

Copy link
Contributor Author

@PPpro PPpro Mar 17, 2020

Choose a reason for hiding this comment

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

已更新

@PPpro PPpro merged commit 55f4c31 into cocos:v2.3.3-release Mar 17, 2020
1 check passed
@PPpro PPpro deleted the 233_editbox branch Mar 17, 2020
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