Solved Do the Canvas has contextReady event?
-
Hi everybody,
I have two canvas element in my project and I have to know two contexts are available before the start drawing. When I use "oncomplete" event handler, I realized that context is not ready at this moment.Canvas { id: b anchors.fill: parent onPaint: { GSystem.initAnim(a,b); GSystem.drawAnim(); } Component.onCompleted: { console.log("b completed : "+b.getContext("2d")); } }
Only I can get the context at first onpaint event. How can I know two context ready and start the drawing without first onpaint event check?
-
You can use available property like the following.
onAvailableChanged: { if (available==true){ console.log(" Available changed - "+b.getContext('2d')); }else { console.log(" Available is not changed") } }
-
@dheerendra
Thank you. I tried it and worked as expected.