[Angular 2]Fabric js & Zone js not working properly together

135 Views Asked by At

I have an Angular 2 project, therefore using zone.js, in which users can edit / draw pictures on a modified canvas (provided by FabricJS).

Until recently, I kept zone.js on 0.8.5 version because I mainly didn't have time to upgrade it and test if each app's functionality was compatible. I eventually upgrade it (up to 0.8.12) to fix an unexpected behavior of another component on IE.

And there lies my problem : with zone js > 0.8.5, when running the app on android device through Cordova, events are sporadically emitted (even if some are missing), but most of the time they are not fired at all.

A blatant example is the "move" event : supposed to be emitted as long as we don't release finger pressure, it gets fired once from time to time but never continuously. Another one is "mouseup", which is not fired anymore since the upgrade.

I already tried to execute my eventListener code outside of the Zone, but sadly it looks like I need to stick inside it to be able to modify component state & properties.

I hope someone can find a solution, or at least a track to follow. thanks.

1

There are 1 best solutions below

0
On BEST ANSWER

The solution was to wait until FabricJS update : using version 2.0.0-beta4 solves every problems I had between ZoneJS and FabricJS.

I hope this could help people struggling with the same issue.