replit / kaboom

💥 JavaScript game library
https://kaboomjs.com
MIT License
2.67k stars 226 forks source link

Skip zero-width character render #787

Closed luluxia closed 1 year ago

luluxia commented 1 year ago

My game allows the user to enter text, when there is a zero-width character in the text component, the following error is generated causing the game to stop running, so I added a judgment to skip the rendering of the zero-width character.

Uncaught DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The source width is 0.

https://kaboomjs.com/play?code=eJwlwkEKwjAQBdB15hSfbkygWnsAb%2BFOXMTMQIJtB9IBi6seoF7Sk4j6ePd4Ux19oKTTbLDFcEJk9hdyXYdzliq7GRFPqbp%2FFLaMlGONyaSiTLAsGAvzIAdyJov5pn%2Bv2%2B%2Frv29CSy7poNUfW3wHuoYPK3oqNw%3D%3D&example=add

slmjkdbtl commented 1 year ago

Yes, thank you!