a problem with the bitmap text when the maxWidth is set and the last letter is space #6717
Closed
Description
Version
- Phaser Version:
3.60.0 - Operating system:
Window - Browser:
Chrome
Description
After i set the BitmapText maxWidth, i was typing some texts. Then i analyzed the bitmap character property by using getTextBounds.
If i type 'space' (default wordwrapCode) at the very last position, it doesn't recognize the white space letter.
between idx 8 and 9, i definetely type 'space' but, there isn't any letter. Actually, it do recognize the idx.
(As you can see, idx property is increased but i property isn't increased)
if i try to use 'setCharacterTint' at this case, after i type like this, it highlight the very next one. (not the current one)
Example Test Code
// bitmapText
this.curTypingText = this.add
.bitmapText(
1162,
this.curTextY[this.curExamListIdx],
'pretendard_bold',
'',
34,
)
.setOrigin(0);
// set MaxWidth
this.curTypingText.maxWidth = 629;
// It is just an example.
this.input.on('keydown',(e) => this.curTypingText.setText([...curText, e.code].join("") );
// after type 'space' at the last letter (right before the maxwidth), it doesn't add space letter at their array.