Open twjasa opened 1 year ago
Thanks for looking into this!
I like the idea of cleaning up the setTimeout
s while possible but I do have some questions. (For context, many of these exist because browsers handles drawing of images in a way where it's difficult to detect completion. The setTimeouts are a simple-ish solution but are obviously kind of hacky)
skipStep2
flag in initializeCropper
? Why are we running step 2 within this and then not running this after step 1? There are no guarantees about how long the browser may take to draw stuff or how the cropper works under the hood, so this could lead to a painful race condition down the line. (in the pull request code, we're essentially running step 1 after step 2 is run in the initializeCropper
function, which seems like it could cause issues)setTimeouts
, how do we know that the browser will finish drawing the pixels to the canvases? (we're reliant on waiting a split second so we can read them back in the next steps)Hey @debkbanerji no problem ๐ Thanks to you for this tool and for the response.
runStep1
in handleInputImage
and leave initializeCropper
(which calls runStep1
-> runStep2
->runStep3
....) inside of inputImage.onload
and that did the trick. Also because now all steps are running one after another I deleted some steps that were repeated.fix-synchronous-steps
and right is master
):bump :(
Changes: