-
Notifications
You must be signed in to change notification settings - Fork 2
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
Node Canvas 2, fabric major bump, trimming chances #8
Comments
I support the idea to implement some breaking changes now. I guess, many devs are now updating theire applications from version 1 to version 2 or will do so soon. The ones that just did it, will still have a good overview of theire application. Amd I would definitely welcome promise support. Could you elaborate which "couple of methods from canvas" you are considering for removal? |
setBackgroundInage and setBackgroundColor or whatever they are called. people could just create their background of choice ( group image gradient ) and set it on backgroundImage or backgroundColor, there is no need for an extra method that can take an Url, since we have other methods to create images from url, and those are extra and create confusion. Few people knows that any fabricObject can be used on backroundImage and any filler ( color, pattern, gradient ) can be used as backgroundColor |
Interesting. Didn't know this either. The docs still say However, is most likely a small breaking change for anybody. |
I am misunderstanding... I use setBackgroundColor with Pattern for make transparent like background in our project - Cleverbrush. This background won't be able to export, this background excluded from layer list. This is only pattern in background. How can I do that functional without "setBackgroundColor"? "Adding promise support" - sounds good! Node canvas still is alpha. It is safe? |
so without setBackgroundColor, you would create a pattern and then do NodeCanvas is still in alpha, but they are speeding up, and this is not a change we do in a week or two, but also gather developers opinions takes time, so i started now. Whatever are the performances of nodeCanvas, that is the future. The new features will be developed just there. |
@aggrosoft here |
So here is my list of things I'm doing via custom code now - maybe there is something which could be part of 3.0 (I don't know if anything of this is breaking):
I would be willing to share my implementation for any of these things, I know this is a lot that could just be done in 2.x Also +1 for finally using promises, currently I'm using wrapper functions for everything to use promises. |
apart the first item all the rest can be added later or now, is not breaking. |
For any of those topics also you can open a discussion thread here on this repo. Is important to keep it clean about the how and why, explaining patterns on why implementing it in the userland is not good and what disadvantages brings. |
cleaning up text style methods is probably breaking. I remember a huge pain working on text and trying to make it more normal. I probably failed. Please share your experience on the weird methods. |
One major annoying thing in the text methods is that findLineBoundaryLeft, findLineBoundaryRight, findWordBoundary etc. depend on _splitText() being called before hand. This is a side effect, I don't know if this is desirable. I just noticed this because I used these methods when overriding _set for the fill property. Also, why are all of these methods private? There is no reason to lock them in, I would also propose a findLineStartIndex and findLineEndIndex method for usage in userland. It was a real pain to wrap my head around all of the code - especially selectionStart/selectionEnd properties being set directly, this could be totally rewritten. |
i guess you are talking about textbox? what index are talking about? the one of the char in the text string, the index in the grapheme array or the style index of a wrapped line in a textbox? Text is so much complicated. IMHO the first rewrite would be eliminating textbox and putting a wrap attribute to the normal text. Adapt the code on just 2 classes ( text and itext ) and then clean it up. But is so hard and without interaction automated tests you break things all along the way. |
Yeah I know, I wrote a custom implementation for rendering Text in fabric 1.x and it was a nightmare. I was talking about I-Text, I don't event know why Textbox has to exists - you are right about doing this just with Text/IText. We should create another issue just for this, also there is no real reason to hold back 3.x for this - or what do you think? |
this is not something that can be done quickly, i do not think it gets out with node canvas update. |
So jsdom 13 is out, what do we need to prepare for the new major release? Custom fonts are terrible with canvas 1.x and this fixes a lot in node rendering |
we should start a branch, called fabric-3.x and test it. I will start the branch, feel free to open PRs against it in which you switch jsdom dep to 13. and we can start to test if UT passes. |
https://github.com/fabricjs/fabric.js/tree/fabric-update-3.x <--- if you want to update jsdom to ^13.0.0 and node canvas 2 to ^2.0.0 we can start need to remove node4 and node6 too ( kinda sad for node 6 tho ) |
Step 1 for example, fabricjs/fabric.js#5356, figure out how JSDOM 13 compared to 9, gets imported and initialized |
i have no idea why i closed it. i think i was sleeping. |
help here is needed, this may be interesting and help all the node-js users, i have some issue on everyday life and cannot really get on speed with this. |
I don't know if this is the right place to ask, but have you ever thought about migrating the whole build process to something more modern like webpack? Also how do you think about using es5/es6 constructs to allow for tree shaking etc. when using fabric in a project? Using Babel this could be easily transpiled to be used with the target browser stack |
Yes i thought about it a lot. So while this will be done sometime, this requires rewriting everything and is on the trail of some more nicer feature i would like to work on. my personal priorities are: Done those i would also work on that, would solve the problem of the large builds for everyone. |
The point is also this is the only contribution i would not want someone to contribute, because if do not know the codebase like my hands, it takes me triple time to solve/debug/suggest solutions. |
How far are we from getting node-canvas 2 support? |
need to fix last 2 issues labeled as 'fix-next' and i can release. If you do not mind the actual 2 known bugs you can start using master as 3.0 |
Thanks for the awesome work. |
I know this one is closed but please keep in mind that this absolutely broke testing fabricjs with jest since they use an older jsdom version to keep support for node 6. Might not be bad to add that into breaking |
fabricjs now uses node-canvas 2 and jsdom 15 i think. |
@asturur Sorry for not getting back to this. The solution we have found is using the jest-environment-jsdom-fifteen package. This does require us to upgrade to the proper version whenever fabricjs decides to do a jsdom upgrade. |
The problem to solve
Node canvas 2 is getting out, will require latest jsdom, that requires node 6.
Node canvas 2 improvements are nice and i would like to upgrade, we need to remove node 4 support and so we should bump fabric to 3.x
This thread is to ask what you think of those changes and if there is a part of the api you think is bad and that ypu would like to fix at the next breaking occasion.
Current situation
We could bump to 3 with the only change being node 4 and move on. Or we could introduce some other breaking changes.
Proposal
Things i would like to kill:
setBackgroundImage api, setGradient api.
I would prefer people to learn to create a gradient, and assign to the right property, no need to have a special api for that.
Adding promise support (without embedding a promise polyfill ).
Leaving callback support.in
If a callback is not provided, the method would return a promise.( maybe this can be done anyway no major bump required )
Breaking changes
node 4 removal
removing a couple of methods from canvas
removal of setPatternFill and setGradientFill from objects
The text was updated successfully, but these errors were encountered: