ソースを参照

fix for text2d line break bug

Adam Bowman 8 年 前
コミット
65ea972f63
1 ファイル変更4 行追加4 行削除
  1. 4 4
      canvas2D/src/Engine/babylon.text2d.ts

+ 4 - 4
canvas2D/src/Engine/babylon.text2d.ts

@@ -715,10 +715,8 @@
                         let char = text[charNum];
                         let charWidth = charWidths[charNum];
 
-                        this.updateInstanceDataPart(d, offset);
-                        offset.x += charWidth;
-
-                        if (!this._isWhiteSpaceCharHoriz(char)) {
+                        if(!this._isWhiteSpaceCharHoriz(char) && !this._isWhiteSpaceCharVert(char)){ 
+                            this.updateInstanceDataPart(d, offset);
                             let ci = texture.getChar(char);
                             d.topLeftUV = ci.topLeftUV;
                             let suv = ci.bottomRightUV.subtract(ci.topLeftUV);
@@ -728,6 +726,8 @@
                             d.superSampleFactor = superSampleFactor;
                             ++d.curElement;
                         }
+
+                        offset.x += charWidth;
                         charNum++;
                     }