stauzs

Text object and text align

Recommended Posts

Hello,

 

While working on the graphical editor for phaser I have stumbled upon the text alignment.

 

Basically, I want to use wordWrapWidth (or other property) as the default width for the text alignment,

at the moment I have 2 possible solutions:

 

1) Quick and dirty would be to modify updateText method like this:
 

var maxLineWidth = 0;

to

 var maxLineWidth = this.style.wordWrap ? this.style.wordWrapWidth : 0;

it would make desired results, but as the text has been drawn on separate canvas - it will make text object texture bigger than required and add an impact on the performance

 

2) Create a wrapper around Text object - or extend Phaser.Text to Phaser.TextBox - and handle offsets internally

 

 

 

Maybe there is somebody who have done something like that before - or I'm just missing something.

 

Any suggestions?

Edited by stauzs

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.