bill před 2 měsíci
rodič
revize
b30b9cc22d

+ 13 - 8
src/core/hook/use-dxf.ts

@@ -10,7 +10,6 @@ import {
   HatchPolylineBoundary,
   vertex,
 } from "@tarikjabiri/dxf";
-import { defaultStyle as iconDefStyle } from '../components/icon'
 import { useStore } from "../store";
 import Zip from "jszip";
 import { LineData } from "../components/line";
@@ -33,6 +32,7 @@ import {
 } from "./use-viewer";
 import { nextTick } from "vue";
 import { SLineData } from "../components/sequent-line";
+import { IRect } from "konva/lib/types";
 
 export const useGetDXF = () => {
   const store = useStore();
@@ -131,7 +131,6 @@ export const useGetDXF = () => {
         }
       }
 
-      console.log(textArr);
       textArr.forEach((item) => {
         const lineWidth = charWidth * item.charCount;
         let p = { x: pad, y: pad + lineNum * fontSize * 1.2 };
@@ -161,18 +160,21 @@ export const useGetDXF = () => {
       });
     };
 
-    const writeImage = async (imgGroup: Group, scaleCallback?: (scale: Size) => () => void) => {
+    const writeImage = async (imgGroup: Group, scaleCallback?: (scale: Size, box: IRect) => () => void) => {
       let curRect = imgGroup.getClientRect();
       const oldViewMat = viewer.viewMat;
       setViewport(curRect);
       await nextTick();
       const imgRect = imgGroup.getClientRect();
-      const back = scaleCallback && scaleCallback({ width: imgRect.width / curRect.width, height: imgRect.height / curRect.height })
+      const back = scaleCallback && scaleCallback({ width: imgRect.width / curRect.width, height: imgRect.height / curRect.height }, imgRect)
       await nextTick()
       const img = (await imgGroup!.toImage({
         pixelRatio: 1,
         quality: 1,
         mimeType: "image/png",
+      }).catch((e) => {
+        console.error(e)
+        throw e
       })) as HTMLImageElement;
       back && back()
       await nextTick()
@@ -195,6 +197,9 @@ export const useGetDXF = () => {
         fetch(img.src)
           .then((res) => res.blob())
           .then((blob) => zip.file(path, blob, {}))
+          .catch(e => {
+            console.error(e)
+          })
       );
       viewer.setViewMat(oldViewMat);
     };
@@ -362,11 +367,11 @@ export const useGetDXF = () => {
           const pathGroup = $stage
             .findOne<Group>(`#${iconItem.id}`)!
             .findOne<Group>(".rep-position")!;
-          await writeImage(pathGroup, (scale) => {
-            const sw = iconItem.strokeWidth || (iconDefStyle as any).strokeWidth || undefined
-            iconItem.strokeWidth = sw && (sw * Math.max(scale.width, scale.height))
+
+          await writeImage(pathGroup, () => {
+            iconItem.strokeScaleEnabled = true
             return () => {
-              iconItem.strokeWidth = sw
+              iconItem.strokeScaleEnabled = false
             }
           });
           break;

+ 1 - 1
src/core/hook/use-global-vars.ts

@@ -366,7 +366,7 @@ export const useRendererDOM = installGlobalVar(() => ref<HTMLDivElement>())
 export const useTempStatus = installGlobalVar(() => {
   const temp = ref(false);
   const enterTemp = <T>(fn: () => T): T => {
-    temp.value = true
+    temp.value = !import.meta.env.DEV && true
     const result = fn()
     if (result instanceof Promise) {
       return result.then(async (data) => {

+ 1 - 1
src/core/html-mount/propertys/components/fix-proportion.vue

@@ -4,7 +4,7 @@
     <el-input-number
       :controls="false"
       :model-value="value"
-      @update:model-value="(value: any) => $emit('update:value', value)"
+      @update:model-value="(value: any) => value !== null && $emit('update:value', value)"
       @change="$emit('change')"
       style="width: 98px"
       :precision="0"

+ 6 - 3
src/core/html-mount/propertys/components/input-num.vue

@@ -3,7 +3,7 @@
     <el-input-number
       :controls="false"
       :modelValue="props.proportion ? transform(value) : value"
-      @update:model-value="(val: any) => props.proportion ? changeHandler(invTransform(val)) : changeHandler(val)"
+      @update:model-value="(val: any) => props.proportion ? changeHandler(invTransform(val), val) : changeHandler(val, val)"
       @change="$emit('change')"
       style="width: 98px"
       :precision="0"
@@ -35,7 +35,10 @@ const emit = defineEmits<{
 }>();
 const { proportion, transform, invTransform } = useProportion();
 
-const changeHandler = (val: number) => {
-  emit("update:value", val);
+const changeHandler = (val: number, rawVal: any) => {
+  if (rawVal !== null) {
+    console.log(rawVal);
+    emit("update:value", val);
+  }
 };
 </script>

+ 2 - 0
src/example/fuse/views/overview/header.vue

@@ -99,6 +99,8 @@ const setViewToTableCover = async () => {
   const oldShowCompass = draw.config.showCompass;
   const oldLabelLineConfig = { ...draw.config.labelLineConfig };
   const oldShowOffset = draw.config.labelLineConfig.showOffset;
+  draw.initViewport(0);
+  await nextTick();
   const getRect = () => draw.stage!.findOne<Group>(`#${DataGroupId}`)!.getClientRect();
 
   const pop = draw.mode.push(Mode.readonly);

+ 1 - 1
src/example/loadding.ts

@@ -16,7 +16,7 @@ watchEffect(() => {
     instance.close()
     instance = null
   }
-  if (loadingStack.value.length && !instance) {
+  if (loadingStack.value.length && !instance && !import.meta.env.DEV) {
     instance = ElLoading.service(loadingStack.value[0])
   }
 })

+ 1 - 1
src/example/platform/platform-resource.ts

@@ -288,7 +288,7 @@ export const taggingGets = {
 
     await getSceneApi(
       "oss",
-      `${prev}/data/floorplan/ai.json?_=${config.version}`
+      `${prev}/data/floorplan/ai-entire.json?_=${config.version}`
     )
       .then((url) => fetch(url))
       .then((res) => res.json())