-
Notifications
You must be signed in to change notification settings - Fork 30
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
Performance problem when using with Angular #24
Comments
Hello, Did your try to start the CanvasCamera plugin within its own zone like this :
|
Hi Sami. I've tried that. My logs are "root", then "CanvasCamera" and (strange) "root" in the onSuccess-callback. Nevertheless Angular's change detection was triggered somewhere in the plugin. Meanwhile I switched off Angular's change detection in the app and it works well. Best Regards Martin |
Hello, Indeed, the callback is invoked by the native part of the plugin (Java or Objective-C). Therefore, there's no zone check at this point. So the zone is again the Angular Zone... I'll try to find a way to fix this issue without having to switch off Angular's change detection. Best Regards, |
Hello, Can you share any example of Ionic 4 Angular 8 code? |
The plugin successively transfers an image to a canvas. In an Angular app, this causes Angular Change Detection to be triggered on every "drawImage" (216 in CanvasCamera.js) and every "clearRect" (206 in CanvasCamera.js) and elsewhere ... up to 60 times a second, which could make the app really slow and a phone melts
In Angular, change detection can be bypassed by zone.runOutSideAngular (...) when drawing on a canvas. But this is not possible in the context of the plugin, since there is no zone.
Solution 1: An Angular version of the plugin that uses runOutSideAngular :)
Solution 2: Optionally provide a wrapper callback that is defined by the app and performs all drawing operations in the context of the wrapper.
Some other ideas to tackle this problem wtihout changing the plugin?
Best Regards
Martin
The text was updated successfully, but these errors were encountered: