Closed GordoRank closed 10 years ago
I would love to have this also.
+1
+1 !
This is a great request, kindly consider it. I could really use this too.
@kangax Would be great to get your thoughts on this. I have a PR ready to go.
I've just added my first experimental version of this into my fork.
It is fully tested with most major object types:
I still have work to do on animating/paths/brushes.
It may be I simply end up turning turbo mode off for these things.
Swamped with work at the moment; will try to get to all PR's soon-ish.
kangax
On Wed, Jan 22, 2014 at 9:54 AM, GordoRank notifications@github.com wrote:
I've just added my first experimental version of this into my fork.
It is fully tested with most major object types:
- Rect
- Circle
- Ellipse
- Triangle
- Image
- Text
- I-Text
- SVG
I still have work to do on animating/paths/brushes.
It may be I simply end up turning turbo mode off for these things.
— Reply to this email directly or view it on GitHubhttps://github.com/kangax/fabric.js/issues/1102#issuecomment-33029736 .
@kangax No worries! I'm lucky that right now my work heavily involves Fabric :-)
We absolutely need this feature for a project we are working on. Once we get a number of objects on canvas the drag performance is really slow and jumpy! Is there any place I can get this fork to implement in our project? Thanks!
This sounds great. The "caveats" are not bad at all. Any update on this topic?
Have you gotten to this pull request yet? We really need this feature. When we have a lot of objects, or a large canvas everything is slow and stuttery.
@ryan-digbil if @GordoRank makes PR for this, I can take a look. I read description and everything sounds awesome except transformation bringing object to top; this would be somewhat of a back-incompatible (albeit purely visual) change that might not be all that great in some applications.
@kangax , any updates for this feature? We really need this feature in my project.
We could make this caching different. Make a sandwich with: all objects under the transforming one cached as a single image, the transforming object all objects over the transforming one cached as a single image.
The performance problem with large canvas would stay anyway.
@asturur Any possible solution that you can suggest?
@kangax, We are facing the same problem when objects get increased the drag performance get lagging. We want to manage around 10k objects. Please respond, Is this issue has been fixed, if no then suggest any workaround for it, so we can proceed further.
10k objects is MUCH work. Some speed improvement can be made with a new render logic i have in mind, but i m far from starting it.
Within my app I have the need to have lots of Fabric objects on canvas at any given time. To make matters worse most of them have to have shadows and/or other expensive effects added to them.
Due to this need, using Fabric as is was an impossibility.
For that reason I added a caching/rasteration rendering pipeline to Fabric.
The caching mode is initialized by setting the property
turbo
totrue
when initializing a Fabric canvas.There are however two caveats, which is why I haven't created a pull request yet for it as I want to gauge feedback from @kangax and anyone else as to whether this is in keeping with Fabrics intentions.
The Caveats :
object.set()
method. This only applies to properties internal to an object liketext
orfontSize
. Any transform properties such astop
orleft
can still be set with dot notation.Upon doing some testing I realised that using
turbo
mode also has the huge benefit of making the initial loading of complex scenes with lots of objects infinitely faster. In my example below we are talking 5 seconds versus 3 minutes!I have uploaded two videos to YouTube to show you before and after. (Please switch the videos to HD as I recorded in 1920x1080)
NO TURBO :
http://www.youtube.com/watch?v=Hv_UI-YhCTk
WITH TURBO :
http://www.youtube.com/watch?v=-Ic9Pgrkbvk
In these two videos I am loading 1000 fabric objects into a canvas. 500 images and 500 I-Text objects. (For this reason the hidden textarea fix in my recent pull request #1111 is paramount as having 500 textareas added to the DOM causes a huge amount of strain)
In the first video you will see that the objects load quickly at first and then slow down to a complete crawl. You will see me waiting for the objects to load as they pop up slowly on by one. Eventually I gave up waiting and attempted to move an object. The result was way less than 1 fps.
In the second video you will see that all objects are drawn to the screen pretty quickly within a few seconds and then all object manipulation happens at a fluid an constant 60fps.
Let me know what you think. If its something that people want included in Fabric despite the two (in my opinion minor) caveats, then I will make a pull request tomorrow.