bill 21 часов назад
Родитель
Сommit
580d4e6fd9

+ 8 - 7
src/example/fuse/views/tabulation/header.vue

@@ -8,7 +8,7 @@
   >
     <template #saves>
       <el-button type="primary" @click="saveHandler" :disabled="draw.drawing">
-        {{$t('sys.save')}}
+        {{ $t("sys.save") }}
       </el-button>
     </template>
     <template #nav>
@@ -46,7 +46,7 @@ import { loading } from "@/example/loadding.ts";
 import { IRect } from "konva/lib/types";
 
 const props = defineProps<{ title: string }>();
-const emit = defineEmits<{ (e: "screenshot", val: boolean): void }>();
+const emit = defineEmits<{ (e: "screenshot", val: false | number): void }>();
 
 const goOverview = async () => {
   await saveHandler();
@@ -65,7 +65,8 @@ const goTab = (tab: TabsPaneContext) => {
 
 const draw = useDraw();
 const getCoverImage = (format: string): Promise<[IRect, Blob]> => {
-  emit("screenshot", true);
+  const pixelRatio = 8;
+  emit("screenshot", pixelRatio);
   return loading(async () => {
     const pop = draw.mode.push(Mode.readonly);
     const oldMat = draw.viewer.viewMat;
@@ -84,7 +85,7 @@ const getCoverImage = (format: string): Promise<[IRect, Blob]> => {
     await asyncTimeout(16);
 
     let fileBlob = await (draw.stage!.toBlob({
-      pixelRatio: 2,
+      pixelRatio,
       mimeType: format,
       quality: 1,
       ...rect,
@@ -140,12 +141,12 @@ const actions = [
           URL.revokeObjectURL(url);
         }
         await saveAs(fileBlob, `${filename}.${ext}`);
-        ElMessage.success(ui18n.t('sys.actions.download.success'));
+        ElMessage.success(ui18n.t("sys.actions.download.success"));
       },
-      text: ui18n.t('sys.actions.download.name'),
+      text: ui18n.t("sys.actions.download.name"),
       icon: "download",
     },
-    baseActions.lang
+    baseActions.lang,
   ],
 ];
 

+ 3 - 3
src/example/fuse/views/tabulation/index.vue

@@ -22,8 +22,8 @@
     :showLabelLine="coverSetting?.showViewportLabelLine"
     :cover-scale="coverSetting?.scale"
     :paperKey="tabulationData?.paperKey"
-    :pixelRatio="needScreenshot ? 6 : pixelRatio"
-    :not-debounce="needScreenshot"
+    :pixelRatio="needScreenshot ? needScreenshot : pixelRatio"
+    :not-debounce="!!needScreenshot"
     :data="overviewData?.store"
     :tab-draw="draw"
     :scale="draw?.viewerConfig.scaleX"
@@ -276,7 +276,7 @@ const setMapHandler = async (config: { url: string; size: Size }) => {
   );
 }
 
-const needScreenshot = ref(false);
+const needScreenshot = ref<false | number>(false);
 const coverSetting = computed(() => {
   const cover = draw.value?.store.items.find((item) => item.key === tableCoverKey);
   return cover?.userData as