fix edit box position error (#20358)

'sysEdit' y position is relate with frame height, not the viewport height. When in FIXED_WIDTH mode, if frame height is bigger than viewport height, it will got error y position.
This commit is contained in:
codetypes 2019-11-23 18:25:49 +08:00 committed by minggo
parent c048d6b6bd
commit e9305431da
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)];