bill před 22 hodinami
rodič
revize
ce437f01ac

+ 1 - 1
src/example/fuse/enter-shared.ts

@@ -397,7 +397,7 @@ export const _saveTabulationData = genLoading(
 
 export const saveTabulationData = (id: any, data: any) => {
   const texts = data.store.layers[defaultLayer].text;
-  let title = texts.find((title: any) => title.key === tableTitleKey);
+  let title = texts?.find((title: any) => title.key === tableTitleKey);
   let content = title ? title.content : "";
 
   return _saveTabulationData(id, { ...data, title: content });

+ 16 - 3
src/example/fuse/views/tabulation/overview-viewport.vue

@@ -10,14 +10,13 @@
 </template>
 
 <script lang="ts" setup>
-import { computed, nextTick, ref, watch, watchEffect } from "vue";
+import { computed, nextTick, onMounted, onUnmounted, ref, watch, watchEffect } from "vue";
 import { Draw } from "../../../components/container/use-draw";
 import { DrawBoard } from "@/index";
 import { debounce, round } from "@/utils/shared";
 import { StoreData } from "@/core/store/store";
 import { Group } from "konva/lib/Group";
 import { lineLen, Size } from "@/utils/math";
-import { defaultStyle as iconDefaultStyle } from "@/core/components/icon";
 import { paperConfigs, PaperKey } from "@/example/components/slide/actions";
 import { IRect } from "konva/lib/types";
 import { DataGroupId } from "@/constant";
@@ -187,6 +186,7 @@ watchEffect(() => {
 });
 
 const updateOrigin = async () => {
+  if (!mounted) return;
   const d = draw.value!;
   // 样式设置
   {
@@ -228,11 +228,12 @@ const updateOrigin = async () => {
   d.config.labelLineConfig.splitWidth = size.width / 90;
   d.config.labelLineConfig.strokeWidth = size.width / 600;
   d.config.labelLineConfig.splitOffset = 5 * d.config.labelLineConfig.fontSize;
-  d.config.labelLineConfig.showOffset = padding * viewScale.value! - 2;
+  d.config.labelLineConfig.showOffset = (padding - 5) * viewScale.value!;
 
   d.initViewport(padding * viewScale.value!);
   const canvas = draw.value!.stage!.container().children[0]
     .children[0] as HTMLCanvasElement;
+  const image = new Image();
   emit("changeOrigin", canvas);
 
   if (import.meta.env.DEV) {
@@ -259,6 +260,18 @@ watch([coverScale, () => props.showLabelLine], () => {
   preed.value && updateOrigin();
   nextTick(() => frameUpdateOrigin.stop());
 });
+let firstLoadTimeout: any;
+let mounted = false;
+onMounted(() => {
+  firstLoadTimeout = setTimeout(() => {
+    mounted = true;
+    updateOrigin();
+  }, 1000);
+});
+onUnmounted(() => {
+  frameUpdateOrigin.stop();
+  clearTimeout(firstLoadTimeout);
+});
 </script>
 
 <style lang="scss" scoped>