PeterStaev / nativescript-photo-editor

🎨 Easily edit an image in your NativeScript app (crop, draw, etc)
Apache License 2.0
47 stars 15 forks source link

Application slow during 5 seconds after editPhoto #10

Open Serge-SDL opened 5 years ago

Serge-SDL commented 5 years ago

Hello,

I try to use NsPhotoEditor and I dot an issue on android: I have just added this test code:

    photoEditor.editPhoto({
        imageSource: imageSource,
        hiddenControls: [],
    }).then((newImage: ImageSource) => {
        console.log('NEW IMAGE: ', newImage.height, newImage.width);

        // that.savePictureSource(newImage);
    }).catch((e) => {
        console.error(e);
    });

(nothing done after photoEditor task) but when I go back to the current page, app is slow during 5 seconds: If I put a TextField in the page, the keybord takes around 5 seconds to be displayed.

Do You have any idea to improve this ? Thanks!

PeterStaev commented 5 years ago

Hey @Serge-SDL , can you provide a reproducible sample of the problem? Also is this angular or non-angular app?

Serge-SDL commented 5 years ago

Hey @PeterStaev,

here are the step to reproduce the issue:

if you do the same without the photo editor part (take picture without drawing), its works fine. Test performed on a samsung A5. tell me if you need more information!

thanks!

Serge-SDL commented 5 years ago

Hello @PeterStaev ! do you succeed reproducing the issue?

PeterStaev commented 5 years ago

Hey @Serge-SDL , sadly I have very limited free time lately to spend on my plugins. So I did not have a chance to look at this yet, and dont have any ETA to do so 😞

Serge-SDL commented 5 years ago

Hey @PeterStaev !

I realy need your plugin so I spend a few more hours to find the minimal code to reproduce the issue. I found that angular related, not problem on pure Nativescript and I opened an issue on nativescript angular github here: https://github.com/NativeScript/nativescript-angular/issues/1726

If you have any idea with these new informations, I'll be glad!

PeterStaev commented 5 years ago

Hey @Serge-SDL , could it be some zone related error? Since lately i have been doing many web angular work this is the most cases when there is some delay in refreshing the UI. May be try to run the code in the promise callbacks inside Angular zone with this.zone.run() and see if it will make any difference. This is just a wild guess 😃

Serge-SDL commented 5 years ago

Hey @PeterStaev , thanks for your answer! Unfortunately tried several things with zone run(), runOutsideAngular() ... but it didn't work. Also try to use workers but I think it's not possible to launch/manage UI from worker...