From b698b883fe4afee8c91d2eb9c0cc85317f0dc4e9 Mon Sep 17 00:00:00 2001 From: yujiang Date: Thu, 29 Apr 2021 19:20:47 +0800 Subject: [PATCH] Update TextField.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果是首个单词就换行了,那么需要回置lineH 论坛贴子: https://bbs.egret.com/thread-60890-1-1.html --- src/egret/text/TextField.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/egret/text/TextField.ts b/src/egret/text/TextField.ts index 4253bab93a..0a4c0267ed 100755 --- a/src/egret/text/TextField.ts +++ b/src/egret/text/TextField.ts @@ -2117,6 +2117,7 @@ namespace egret { lineCharNum = 0; } + let old = lineH; if (values[sys.TextKeys.type] == egret.TextFieldType.INPUT) { lineH = values[sys.TextKeys.fontSize]; } @@ -2195,6 +2196,10 @@ namespace egret { // w = measureTextWidth(words[k], values, element.style); if (lineW != 0 && lineW + w > textFieldWidth && lineW + k != 0) { + //如果是首个单词就换行了,那么需要回置lineH + if (k == 0){ + lineH = old; + } break; } if (ww + w > textFieldWidth) {//纯英文,一个词就超出宽度的情况