-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Added a justify-left option for text alignment #4369
Conversation
Hm, apparently i nested too deeply in enlargeSpaces. I don't know how to fix this though, i needed the extra if statement for it to work |
Would be awesome to get this. Will make justify useful :-) |
I see i see... so now is |
😇 Let say it has potential |
Jokes apart, i see in the code you are sort of introducing the concept of paragraph in textbox. that iText does not have. So you are detecting the hard new lines in textbox and skip justification for them. I have some thought about that.
|
@asturur Thanks for preventing me from breaking our beloved fabric.js 🙏 I forgot to check how IText would behave, and i'll admit that using this feature on IText broke it. You are right, it should be called justify-wrapped because now there are 2 options that are more logical:
In enlargeSpaces i changed the if statement to: Here are the scenarios i tested after my second commit: Textbox IText & Text Is this ok? I don't see an easy way to determine where the user is using a linebreak manually, because IText and Text insert newlines after each line in their version of _splitTextIntoLines. This means we can only justify all lines, or none of the lines. By the way, what can i do to stop the integration test from failing? I have to nest this deeply. |
Need to download the code and give it a shot, i guess with the current code there is anyway a method to figure out what lines are hard breaked by I'll try to find time tomorrow. |
That would be great, thanks |
I guess there was no time to be found haha. Is there anything i can do? Like looking into the styleMap for example? |
Yes i m very loaded with things to do at work and in private life. Is a couple of weeks i m not working that much on fabricjs. |
Ok, no rush |
Continued in #4441 |
textAlign: 'justify' gives the default style for justified text, textAlign: 'justify-left' aligns the lines with breaks and the final line to the left.
Replaces #3896, which was based on 1.x