فهرست منبع

fix: 修改bug

bill 3 ماه پیش
والد
کامیت
ba96201e1b

+ 2 - 0
src/core/components/line/index.ts

@@ -99,6 +99,7 @@ export const interactiveToData: InteractiveTo<"line"> = ({
 export const interactiveFixData: InteractiveFix<"line"> = ({ data, info }) => {
   const nv = [...info.consumed, info.cur!];
 
+  data.points.length = nv.length
   for (let i = 0; i < nv.length; i++) {
     if (inRevise(data.points[i], nv[i])) {
       if (!data.points[i]) {
@@ -114,6 +115,7 @@ export const interactiveFixData: InteractiveFix<"line"> = ({ data, info }) => {
       }
     }
   }
+  data.lines.length = nv.length - 1
   for (let i = 0; i < nv.length - 1; i++) {
     if (!data.lines[i]) {
       data.lines[i] = {

+ 0 - 1
src/core/components/line/use-draw.ts

@@ -379,7 +379,6 @@ export const normalLineData = (data: LineData, ctx: NLineDataCtx) => {
   for (let id of pointIds) {
     if (!linePointIds.includes(id)) {
       const ndx = data.points.findIndex(p => p.id === id)
-      console.log('delPoint', ndx)
       ~ndx && data.points.splice(ndx, 1)
     }
   }

+ 19 - 8
src/core/helper/split-line.vue

@@ -12,6 +12,13 @@
         }"
         v-for="textConfig in info.texts"
       />
+      <!-- <v-circle
+        :config="{ ...viewMat.point(p), fill: '#FF0000', radius: 10 }"
+        v-for="p in points"
+      />
+      <v-circle :config="{ ...rang?.rb, fill: '#00FF00', radius: 10 }" />
+      <v-circle :config="{ ...rang?.lt, fill: '#00FF00', radius: 10 }" />
+      <v-circle :config="{ ...center, fill: '#0000FF', radius: 10 }" /> -->
     </v-group>
   </template>
 </template>
@@ -90,17 +97,20 @@ const center = computed(() => {
 
 const compsInfo = useComponentsAttach(
   (type, item) => {
-    if (type === "icon" && (item as any).fixScreen) {
-      return [];
+    if (config.labelLineConfig.showShapeTypes.includes(type)) {
+      if (type === "icon" && (item as any).fixScreen) {
+        return [];
+      } else {
+        return components[type].getSnapPoints(item as any);
+      }
     } else {
-      return components[type].getSnapPoints(item as any);
+      return [];
     }
   }
   // ["polygon"]
 );
 onUnmounted(compsInfo.cleanup);
 
-const viewerTransform = useViewerTransform();
 const points = computed(() => compsInfo.attachs.flatMap((p) => p));
 const rectAxisSteps = computed(() => {
   const axis = {
@@ -123,8 +133,9 @@ const rectAxisSteps = computed(() => {
       return;
     }
 
-    const can = (data: number) =>
-      Math.abs(data - cur) > config.labelLineConfig.splitOffset;
+    const can = (data: number) => {
+      return Math.abs(data - cur) > config.labelLineConfig.splitOffset;
+    };
 
     let i = axis.length - 1;
     for (i; i >= 0; i--) {
@@ -140,10 +151,10 @@ const rectAxisSteps = computed(() => {
     } else if (i === -1) {
       axis[0] = cur;
     } else if (i === axis.length - 1) {
-      axis[i] = cur;
+      // axis[i] = cur;
     }
   };
-  const pixels = points.value.map((p) => viewerTransform.value.point(p));
+  const pixels = points.value.map((p) => viewMat.value.point(p));
   const ph = [...pixels].sort((a, b) => a.x - b.x);
   const pv = [...pixels].sort((a, b) => a.y - b.y);
   for (const point of pv) {

+ 2 - 1
src/core/hook/use-config.ts

@@ -23,7 +23,8 @@ const defLableLineConfig = {
   showOffset: 20, 
   fontSize: 12,
   splitWidth: 10,
-  type: 'fix'
+  type: 'fix',
+  showShapeTypes: ['line']
 }
 export type Config = {
   showGrid: boolean;

+ 0 - 1
src/core/hook/use-transformer.ts

@@ -719,7 +719,6 @@ export const useLineTransformer = <T extends LineTransformerData>(
         ? repShape
         : (repShape as unknown as Group).findOne<Line>(".line")!;
       const update = (data: T) => {
-        console.error("update");
         const attitude = new Transform(data.attitude);
         const inverMat = attitude.copy().invert();
         setShapeTransform(repShape, attitude);

+ 1 - 1
src/core/html-mount/propertys/describes.json

@@ -37,7 +37,7 @@
   },
   "strokeScaleEnabled": {
     "type": "check",
-    "label": "固定边框粗细",
+    "label": "边框粗细随缩放",
     "default": false,
     "layout-type": "row"
   },

+ 21 - 12
src/example/constant.ts

@@ -1,4 +1,3 @@
-
 export const iconGroups = [
   {
     name: "常用名称",
@@ -92,8 +91,18 @@ export const iconGroups = [
           { icon: "danke_o", name: "弹壳" },
           { icon: "shouqiang_o", name: "手枪" },
           { icon: "buqiang_o", name: "步枪" },
-          { icon: "xuepo_o", name: "血泊" },
-          { icon: "xueji_o", name: "血迹" },
+          {
+            icon: "xuepo_o",
+            name: "血泊",
+            color: "#FF0000",
+            parse: { fill: "#FF0000", stroke: undefined },
+          },
+          {
+            icon: "xueji_o",
+            name: "血迹",
+            color: "#DD2C2C",
+            parse: { fill: "#DD2C2C", stroke: undefined },
+          },
           { icon: "shitiz_o", name: "尸体正面" },
           { icon: "shitib_o", name: "尸体背面" },
           { icon: "shitifuhao_o", name: "尸体" },
@@ -103,12 +112,12 @@ export const iconGroups = [
   },
 ];
 export const aiIconMap = {
-  SingleDoor: 'cad-men',
-  DoubleDoor: 'cad-shuangkaimen',
-  SlideDoor: 'cad-yimen',
-  Pass: 'cad-yakou',
-  SingleWindow: 'cad-chuang',
-  BayWindow: 'cad-piaochuang',
-  FrenchWindow: 'cad-luodichuang',
-  Chair: 'Desk'
-}
+  SingleDoor: "cad-men",
+  DoubleDoor: "cad-shuangkaimen",
+  SlideDoor: "cad-yimen",
+  Pass: "cad-yakou",
+  SingleWindow: "cad-chuang",
+  BayWindow: "cad-piaochuang",
+  FrenchWindow: "cad-luodichuang",
+  Chair: "Desk",
+};

+ 9 - 6
src/example/env.ts

@@ -46,17 +46,17 @@ const sParams = new URLSearchParams(location.search);
 });
 const updateParams = () => {
   const rParams = urlGetQuery(location.href);
-  console.log('updateParams', rParams)
+  console.log("updateParams", rParams);
   if (inRevise(rParams, params.value)) {
     params.value = rParams;
   }
 };
+updateParams();
 
 watch(
-  params,
-  () => {
+  () => ({ ...params.value }),
+  (nParams, oParams) => {
     const sParams = new URLSearchParams();
-    console.log('变化?')
     for (const key in params.value) {
       params.value[key] && sParams.append(key, params.value[key]);
     }
@@ -66,12 +66,15 @@ watch(
         "?" +
         sParams.toString()
     );
+    if (inRevise(nParams, oParams)) {
+      setTimeout(() => {
+        location.reload();
+      }, 1000);
+    }
   },
   { deep: true }
 );
 
-    console.log('变化?123123')
-updateParams();
 window.addEventListener("hashchange", updateParams);
 
 const getQuisk = (key: string) =>

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

@@ -85,6 +85,7 @@ const login = (isBack = true) => {
     return;
   }
 
+  console.log(import.meta.env.VITE_LOGIN_VIEW)
   if (import.meta.env.VITE_LOGIN_VIEW) {
     const p: any = { ...params.value };
     delete p.token;
@@ -101,7 +102,7 @@ const login = (isBack = true) => {
       delete query["redirect"];
       link = urlUpdateQuery(url.toString(), query, true);
     }
-    // location.replace(link);
+    location.replace(link);
   }
 };
 

+ 4 - 2
src/example/fuse/views/overview/slide-icons.vue

@@ -14,7 +14,7 @@
         <div class="icon-items">
           <div
             v-for="item in typeChildren.children"
-            @click="drawIcon(`./icons/${item.icon}.svg`, item.name)"
+            @click="drawIcon(`./icons/${item.icon}.svg`, item.name, item)"
           >
             <Icon :name="item.icon" size="32px" />
             <span>{{ item.name }}</span>
@@ -36,8 +36,9 @@ import { iconGroups as groups } from "../../../constant";
 const props = defineProps<{ draw: Draw }>();
 const emit = defineEmits<{ (e: "exit"): void }>();
 
-const drawIcon = async (url: string, name: string) => {
+const drawIcon = async (url: string, name: string, item: any) => {
   const svgContent = parseSvgContent(await getSvgContent(url));
+  console.log(item);
 
   const maxSize = 100;
   const addHeight = (maxSize / svgContent.width) * svgContent.height;
@@ -57,6 +58,7 @@ const drawIcon = async (url: string, name: string) => {
       ...size,
       name,
       fill: "#000000",
+      ...(item.parse || {}),
     },
     true
   );

+ 9 - 2
src/example/fuse/views/tabulation/slide.vue

@@ -15,7 +15,6 @@ import {
 import { useDraw } from "../../../components/container/use-draw.ts";
 import { computed, nextTick, reactive, watch } from "vue";
 import { tabulationData } from "../../store";
-import { ElMessageBox } from "element-plus";
 import { genTabulationData } from "./gen-tab.ts";
 import { defaultLayer } from "@/constant/index.ts";
 
@@ -28,7 +27,15 @@ const paper = reactive({
     handler: () => (tabulationData.value.paperKey = item.key as PaperKey),
   })),
 });
-const menus = reactive([paper, text, serial, table]);
+const menus = reactive([
+  paper,
+  {
+    ...text,
+    payload: { ...text.payload, preset: { ...text.payload.preset, fontSize: 16 } },
+  },
+  serial,
+  table,
+]);
 
 const setPaperAfterHandler = async (paperKey: PaperKey, oldPaperKey?: PaperKey) => {
   let isUpdate = false;