ShotgunJed Posted August 1, 2017 Share Posted August 1, 2017 What is causing this? Also when I set a Text's text to "" or '', if I print it, I get ' '. I also checked the code and I'm wondering why this space is added? Quote Link to comment Share on other sites More sharing options...
lloydevans Posted August 1, 2017 Share Posted August 1, 2017 http://pixijs.download/dev/docs/core_text_Text.js.html#line648 text = String(text === '' || text === null || text === undefined ? ' ' : text); ShotgunJed 1 Quote Link to comment Share on other sites More sharing options...
lloydevans Posted August 1, 2017 Share Posted August 1, 2017 An empty string evaluates as 'falsy', a string with a single space doesn't. My guess is that's something to do with the reasoning behind it. You can simply set the text property without using "+=" for the first time. Quote Link to comment Share on other sites More sharing options...
ShotgunJed Posted August 1, 2017 Author Share Posted August 1, 2017 Thanks. No wonder i was getting confused printing the Text.text. I fixed it by first building the complete string to some variable, then setting the Text.text to that variable. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.