|
@@ -52,5 +52,18 @@ export const svgtopng = async (svg: any, width: any, height: any) => {
|
|
|
await v.start()
|
|
|
const blob = await canvas.convertToBlob()
|
|
|
const base64 = await blobToBase64(blob)
|
|
|
+
|
|
|
+ releaseCanvas(canvas)
|
|
|
return base64
|
|
|
}
|
|
|
+
|
|
|
+function releaseCanvas(canvasElement) {
|
|
|
+
|
|
|
+ const ctx = canvasElement.getContext('2d')
|
|
|
+ ctx.clearRect(0, 0, canvasElement.width, canvasElement.height)
|
|
|
+
|
|
|
+
|
|
|
+ cancelAnimationFrame(canvasElement.animationId)
|
|
|
+
|
|
|
+ canvasElement = null
|
|
|
+}
|