phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Add raw character index to BitmapText text bounds

Open JaroVDH opened this issue 3 years ago • 0 comments

This PR:

  • Adds a new feature

Describe the changes below: Character text bounds for BitmapText are currently indexed with the already wrapped text. This minor change includes the actual index to the bounds.

From the wording I think the current index was always meant to be the actual base index, but for backwards compatibility I only added it as a new property.

What this solves: The current index doesn't allow you to find the bounds by starting from the text you provide, rather than the internal wrapped text. For example if I had a text like Hello there! that gets wrapped due to max width like this:

Hello
there!

then I can't find the bounds of there without mapping my text to the interal wrapped text, because everything starting from t is shifted over 1 because of the dropped space character.

JaroVDH avatar Aug 20 '22 10:08 JaroVDH