[4.6.0] toDataURL does not return correct image when putImageData is used
Description
I am using KineticJS in conjunction with JSManipulate, and recently upgraded KineticJS from 4.0.5 to 4.6.0. Since I upgraded, I can no longer use stage.toDataURL() properly, it returns the wrong image.
My application allows users to do the following:
- select a background image
- apply a transformation to the image (using JSManipulate)
- save the image (with extra text)
The JSManipulate workflow is involves getting the canvas image, applying the transformation, and returning the new image using getImageData() and putImageData(). Instead of returning the image on the canvas, stage.toDataURL() returns what is on the canvas, substituting the transformed image with the original background image.
Ex.
Screenshot of canvas
Screenshot of image returned by canvas.context.toDataURL()
Screenshot of image returned by stage.backgroundLayer.toDataURL()
Screenshot of image returned by stage.toDataURL()

Summary & Workaround
I believe this is an issue either with the image's or layer's toDataURL() method, or the way KineticJS handles the putImageData(). This is a regression bug introduced since 4.0.5, and has been around for at least 3 months, given #453.
I have implemented a workaround which involves creating a new image background using the canvas' dataURL when I save the canvas.
I should mention that I'm using a custom download with Core, Image, Rect, Text, Animation, and DragAndDrop.
Truly sorry for the headache. This issue will be fixed by v4.6.1 or v4.6.2, depending on priorities. Thanks for hanging in there!
Looking forward to the fix; thanks for all your hard work!