Skip to content
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

Remove duplicate code and fix justify style issue #2370

Merged
merged 1 commit into from
Jul 31, 2015
Merged

Remove duplicate code and fix justify style issue #2370

merged 1 commit into from
Jul 31, 2015

Conversation

asturur
Copy link
Member

@asturur asturur commented Jul 29, 2015

A little bit of cleaning plus bugfix:

IText justified without style breakdown.

image

Fixes case in wich spaceWidth is infinite.

The justified spaces are not calculated right as of now, but I cannot fix this bug now.

@asturur
Copy link
Member Author

asturur commented Jul 29, 2015

@kangax ready to merge!

@asturur asturur changed the title Remove duplicate code Remove duplicate code and fix justify style issue Jul 29, 2015
this._renderChars(method, ctx, words[i], left + leftOffset, top, lineIndex);
leftOffset += ctx.measureText(words[i]).width + spaceWidth;
// stretch the line
var words = line.split(/\s+/),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, don't we have a separate method for this now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you mean splitting words, no i don t think so.
i can check.
anyway that code needs a review.

measuring width of words without calculating styles is very wrong and produce bad ( rare ) result.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no we do not have any method for splitting line in words.

kangax added a commit that referenced this pull request Jul 31, 2015
Remove duplicate code and fix justify style issue
@kangax kangax merged commit 44eb376 into fabricjs:master Jul 31, 2015
@asturur asturur deleted the fix-textboxcursor branch August 7, 2015 09:02
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants