Browse Source

Merge pull request #1741 from abow/text2d

fix for text2d letter overlapping when text is set
Loïc Baumann 8 năm trước cách đây
mục cha
commit
77b3b1a37c
1 tập tin đã thay đổi với 2 bổ sung1 xóa
  1. 2 1
      canvas2D/src/Engine/babylon.text2d.ts

+ 2 - 1
canvas2D/src/Engine/babylon.text2d.ts

@@ -719,7 +719,8 @@
                         let char = text[charNum];
                         let charWidth = charWidths[charNum];
 
-                        if(!this._isWhiteSpaceCharHoriz(char) && !this._isWhiteSpaceCharVert(char)){ 
+                        if(char !== "\t" && !this._isWhiteSpaceCharVert(char)){ 
+                            //make sure space char gets processed here or overlapping can occur when text is set
                             this.updateInstanceDataPart(d, offset);
                             let ci = texture.getChar(char);
                             d.topLeftUV = ci.topLeftUV;