Skip to content

Commit 4a33c7b

Browse files
committed
Don't reset text
1 parent a7b3cd5 commit 4a33c7b

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/gameobjects/bitmaptext/static/BitmapTextCanvasRenderer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ var BitmapTextCanvasRenderer = function (renderer, src, interpolationPercentage,
6868
var lineOffsetX = 0;
6969

7070
// Update the bounds - skipped internally if not dirty
71-
src.getTextBounds(false);
71+
var bounds = src.getTextBounds(false);
7272

7373
// In case the method above changed it (word wrapping)
74-
text = src._text;
75-
textLength = text.length;
74+
if (src.maxWidth > 0)
75+
{
76+
text = bounds.wrappedText;
77+
textLength = text.length;
78+
}
7679

7780
var lineData = src._bounds.lines;
7881

src/gameobjects/bitmaptext/static/BitmapTextWebGLRenderer.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,14 @@ var BitmapTextWebGLRenderer = function (renderer, src, interpolationPercentage,
101101
var lineOffsetX = 0;
102102

103103
// Update the bounds - skipped internally if not dirty
104-
src.getTextBounds(false);
104+
var bounds = src.getTextBounds(false);
105105

106106
// In case the method above changed it (word wrapping)
107-
text = src._text;
108-
textLength = text.length;
107+
if (src.maxWidth > 0)
108+
{
109+
text = bounds.wrappedText;
110+
textLength = text.length;
111+
}
109112

110113
var lineData = src._bounds.lines;
111114

0 commit comments

Comments
 (0)