New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextMetrics.wordWrap() customization of splitting method #6251
TextMetrics.wordWrap() customization of splitting method #6251
Conversation
…ng a word into characters by TextMetrics.wordWrap()
Codecov Report
@@ Coverage Diff @@
## dev #6251 +/- ##
=========================================
+ Coverage 76.99% 77% +<.01%
=========================================
Files 202 202
Lines 10247 10249 +2
=========================================
+ Hits 7890 7892 +2
Misses 2357 2357
Continue to review full report at Codecov.
|
Thanks for pulling this together. I don't have a problem with this functionally, but wondered if we could do something a little simpler for the API.
|
For reference, canBreakWords and canBreakChars are other examples of code split out into functions that can be overridden; in those cases to help with custom CJK language support. |
@themoonrat I am happy to change things to better fit the rest of the code :). If I understand correctly, the way you'd like this to be used would be in essence:
That sounds fair. My personal preference is a configuration variable, just like the way I implemented it, but I am not here to impose my preferences on others :D. I'll update the PR soonish! |
@themoonrat I've got one question though: you mentioned And how about changing the line "This method exists to be easily overriden" to something like "Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior" |
Yeah, I'd say it's a mistake that they are marked as private! Your changes would be appreciated :) |
…is implemented, from a configuration constant to just overriding a function call.
…etrics` and updated their docs slightly
Pushed the changes - |
Do you want to join PixiJS Slack? I can sent an invite to your public email on your site. |
Sure! I was hoping to contribute a bit more, as long as life allows, so that might be helpful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some last cleanup bit, otherwise this looks G2G. Thanks!
<insert a generic excuse about sleep deprivation/doing fast too quickly/something here> |
You’re on a serious roll this release @EvidentlyCube! |
Let's see how much more I can fit before the next release 🙃. And if it's around the corner - the one after that! |
Description of change
As requested in #6201, made it so that the method used to split a token into characters in
TextMetrics.wordWrap()
can be customized.Pre-Merge Checklist
npm run lint
)npm run test
)