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

默认设置editbox的编辑模式为SINGLE_LINE 否则若是任意输入情况下,输入框垂直居中对齐会无效,引擎会强制改为顶对齐,除非手动设置。 #76

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions source/src/fairygui/GTextInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ namespace fgui {
this.on(Event.TOUCH_END, this.onTouchEnd1, this);

this.autoSize = AutoSizeType.None;

//Fix:默认设置editbox的编辑模式为SINGLE_LINE 否则若是任意输入情况下,垂直居中对齐会无效,引擎会强制改为顶对齐,除非手动设置
this.singleLine = UIConfig.gInputFieldSingle;

}

public set editable(val: boolean) {
Expand Down
5 changes: 5 additions & 0 deletions source/src/fairygui/UIConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ namespace fgui {

public static linkUnderline: boolean = true;

//对cocosEditBox做兼容处理
//默认设置editbox的编辑模式为SINGLE_LINE 否则若是任意输入情况下,输入框垂直居中对齐会无效,引擎会强制改为顶对齐,除非手动设置。
//注意:改为Single_Line后,因为cocos的输入框策略,可以输入除换行符外的任意字符,如果要输入换行符,cocos引擎内部仍然会改为顶对齐
public static gInputFieldSingle:false = false;

/** !#en
Default group name of UI node.<br/>
!#zh
Expand Down