Pārlūkot izejas kodu

[web_demo] 解决ocr重复预测同一图片时画布没刷新的问题

yanxin 1 gadu atpakaļ
vecāks
revīzija
2d35e6391e

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
src/dist/assets/index-c38ed635.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
src/dist/assets/index-b3ce137d.css


+ 2 - 2
src/dist/index.html

@@ -4,8 +4,8 @@
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>DocumentAI Web Demo</title>
-    <script type="module" crossorigin src="./assets/index-c38ed635.js"></script>
-    <link rel="stylesheet" href="./assets/index-b3ce137d.css">
+    <script type="module" crossorigin src="./assets/index-65d1538b.js"></script>
+    <link rel="stylesheet" href="./assets/index-f5a8b6ab.css">
   </head>
   <body>
     <div id="app"></div>

+ 6 - 1
src/pages/main/views/Detection/LayoutAnalysis.vue

@@ -314,7 +314,12 @@ const predict = async () => {
     return;
   }
 
-  fa_canvas.clear()
+  if (fa_canvas != null) {
+    fa_canvas.dispose();
+    fa_canvas = null;
+    fa_canvas = new fabric.Canvas(canvas.value);
+    fa_canvas.clear()
+  }
   figure_rects.splice(0)
   table_rects.splice(0)
 

+ 6 - 0
src/pages/main/views/Recognize/ocr.vue

@@ -352,6 +352,12 @@ const predict = async () => {
     alert('请先指定语言!')
     return;
   }
+
+  if (fa_canvas != null) {
+    fa_canvas.dispose();
+    fa_canvas = null;
+    fa_canvas = new fabric.Canvas(canvas.value);
+  }
   rects.splice(0)
 
   const img = document.getElementById("show-img") as HTMLImageElement;