-
-
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
feat(Text): condensed styles structure v6 #8006
Conversation
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.
Looks good
Co-authored-by: Shachar <34343793+ShaMan123@users.noreply.github.com>
…ric.js into styles-condensed-v6
Code Coverage Summary
|
It does that all the time. The unit tests were what I intended to ask about. |
@asturur are we okay to merge this? |
conflicts @melchiar |
simple conflicts as I see it. All should be resolved to the master tag |
Code Coverage Summary
|
should be good now |
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.
I think we should use Object.assign in all fromObject methods so we don't mutate the arg
Object.assign is already used in the |
Code Coverage Summary
|
Code Coverage Summary
|
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.
@melchiar I do not understand the tests... Something seems off
i think we need to solve the mistery of line 193 and 217 in unit/text.js |
Code Coverage Summary
|
Should be good now. Turns out that a unit test issue I had tried to "fix" was actually related to the mutation bug that shachar noticed. |
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.
Looks good.
I would like to ask a final question from a previous discussion but I think it's important.
let data// has styles array set
fabric.Text.fromObject(data) // respects styles
new fabric.Text(data) // doesn't respect styles
Am I right? I don't like that. I think it should respect both use cases
It's a design issue that lacks in fabric
I don't think that is a real issue, exactly as you can't instantiate an obejct with a serialized pattern, gradient or element. You don't exepct an js object to be initialized with its JSON.stringify form without passing into JSON.parse, and this is exactly the same |
Well I still dislike it. |
I don't really have a strong opinion on it either way. I agree we should be trying to make the dev experience as intuitive as possible and not force a heavy reliance on docs to show the correct way to call each method. I also feel though that methods like |
@ShaMan123 is an issue with serialization, toObject and toJSON are called when you have to convert objects to strings to store them somewhere. If you call toObject on something, to use it again you have to call fromObject. |
I understand your point but I still think it's too fragile. |
To move forward please dismiss your request for changes that have been addressed. |
Styles structure rewrite for v6 (ported from #7842)