Skip to content

Commit

Permalink
fix mac editbox show bug when resize
Browse files Browse the repository at this point in the history
  • Loading branch information
mmyduckx committed Jun 26, 2023
1 parent f9d7a40 commit 3e71446
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions native/cocos/ui/edit-box/EditBox-mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ of this software and associated engine source code (the "Software"), a limited,

#include "cocos/bindings/jswrapper/SeApi.h"
#include "cocos/bindings/manual/jsb_global.h"
#include "engine/EngineEvents.h"

#import <AppKit/AppKit.h>

Expand Down Expand Up @@ -149,6 +150,9 @@ - (NSAttributedString *)attributedStringForObjectValue:(id)anObject withDefaultA
Implementation of global helper functions.
************************************************************************/
namespace {

static cc::events::Resize::Listener resizeListener;

void getTextInputCallback() {
if (!g_textInputCallback.isUndefined())
return;
Expand Down Expand Up @@ -241,6 +245,10 @@ void init(const cc::EditBox::ShowInfo &showInfo) {
initTextView(showInfo);
else
initTextField(showInfo);

resizeListener.bind([&](int /*width*/, int /*height*/ , uint32_t /*windowId*/) {
cc::EditBox::complete();
});
}
} // namespace

Expand Down

0 comments on commit 3e71446

Please sign in to comment.