bill 2 years ago
parent
commit
02984dae49
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/views/draw-file/modal.tsx

+ 6 - 1
src/views/draw-file/modal.tsx

@@ -138,6 +138,7 @@ enum ImageType {
 type FuseImageRet = { type: ImageType, blob: Blob | null }
 const getFuseImage = async (iframe: HTMLIFrameElement) => {
   const iframeElement = iframe.contentWindow?.document.documentElement
+  
   if (!iframeElement) {
     return null
   }
@@ -147,7 +148,11 @@ const getFuseImage = async (iframe: HTMLIFrameElement) => {
   const fuseCnavas = targetWindow.document.querySelector('.scene-canvas > canvas') as HTMLElement
   
   if (fuseCnavas) {
-    return domScreenshot(fuseCnavas).then(blob => ({ type: ImageType.FUSE, blob }))
+    const dataURL = await targetWindow.sdk.screenshot(540, 390)
+    const res = await fetch(dataURL)
+    const blob = await res.blob()
+    return { type: ImageType.FUSE, blob }
+    // return domScreenshot(fuseCnavas).then(blob => ({ type: ImageType.FUSE, blob }))
   }
   const isLaser = targetWindow.document.querySelector('.laser-layer')