fix edit box position error (#20358)

This commit is contained in:
HALX99 2019-11-24 00:27:19 +08:00 committed by GitHub
parent 179ec6ed67
commit 22a085e6b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -196,10 +196,10 @@ void EditBoxImplMac::setNativeVisible(bool visible)
void EditBoxImplMac::updateNativeFrame(const cocos2d::Rect &rect)
{
GLView* eglView = Director::getInstance()->getOpenGLView();
auto viewPortRect = eglView->getViewPortRect();
auto frameSize = eglView->getFrameSize();
// Coordinate System on OSX has its origin at the lower left corner.
// https://developer.apple.com/library/ios/documentation/General/Conceptual/Devpedia-CocoaApp/CoordinateSystem.html
auto screenPosY = viewPortRect.size.height - rect.origin.y - rect.size.height;
auto screenPosY = frameSize.height - rect.origin.y - rect.size.height;
[_sysEdit updateFrame:CGRectMake(rect.origin.x,
screenPosY,
rect.size.width, rect.size.height)];