bill недель назад: 3
Родитель
Сommit
fcce0816b8

+ 1 - 1
src/core/hook/use-interactive.ts

@@ -269,7 +269,7 @@ export const useInteractiveDots = ({
           }
         }
         if (joinIds.length) {
-          return joinIds;
+          return [joinIds[0]];
         }
       }
     };

+ 17 - 6
src/example/fuse/views/tabulation/index.vue

@@ -66,7 +66,7 @@ import { Transform } from "konva/lib/Util";
 import { MathUtils } from "three";
 import { components } from "@/core/components";
 import { ShapeType } from "@/index";
-import { copy, mergeFuns, round } from "@/utils/shared";
+import { mergeFuns, round } from "@/utils/shared";
 import { getImageSize } from "@/utils/shape";
 import { tabCustomStyle } from "../defStyle";
 import { defaultLayer } from "@/constant";
@@ -164,7 +164,6 @@ const setMapHandler = async (config: { url: string; size: Size }) => {
 {
   const serialTable = computed(() => {
     const tables = draw.value?.store.getTypeItems("table");
-    console.log("update");
     return tables && tables.find((table) => table.key === tableSerialTableKey);
   });
 
@@ -172,10 +171,22 @@ const setMapHandler = async (config: { url: string; size: Size }) => {
     if (!draw.value || !serialTable.value) return;
     const un = draw.value.menusFilter.setShapeMenusFilter(
       serialTable.value.id,
-      (menu) => [
-        { label: ui18n.t("sys.update"), handler: () => updateSerialTable(false) },
-        ...menu,
-      ]
+      (menus) => {
+        menus = menus.filter((item) => item.label !== ui18n.t("sys.del"));
+        return [
+          { label: ui18n.t("sys.update"), handler: () => updateSerialTable(false) },
+          ...menus,
+          {
+            label: ui18n.t("sys.del"),
+            handler: () => {
+              draw.value?.store.setItem("table", {
+                value: { ...serialTable.value, hide: true },
+                id: serialTable.value!.id,
+              });
+            },
+          },
+        ];
+      }
     );
     onCleanup(un);
   });

+ 35 - 33
src/example/platform/platform-draw.ts

@@ -45,7 +45,7 @@ const getSizePlaceBoxImage = ({ width, height }: Size) => {
     borderWidth / 2,
     borderWidth / 2,
     width - borderWidth,
-    height - borderWidth
+    height - borderWidth,
   );
 
   return canvas.toDataURL(); // 返回图片的Data URL字符串
@@ -94,7 +94,7 @@ const getCoverShapes = (cover: SceneResource["cover"]) => {
   const height = cover.bound.y_max - cover.bound.y_min;
   const mat = new Transform().translate(
     cover.bound.x_min + width / 2,
-    cover.bound.y_min + height / 2
+    cover.bound.y_min + height / 2,
   );
 
   const thumb: ImageData = {
@@ -203,14 +203,14 @@ const getTaggingShapes = async (taggings: SceneResource["taggings"]) => {
     }
     const shape = {
       ...getBaseItem(),
-      ...(item.size || { width: 100, height: 100 }),
       name: item.name,
       key: item.key,
       createTime: now + ndx,
       url: item.url,
       mat: mat.m,
       zIndex: 1,
-      ...iconDefaultStyle
+      ...iconDefaultStyle,
+      ...item.size,
     };
 
     if (!item.url.includes(".svg")) {
@@ -224,13 +224,12 @@ const getTaggingShapes = async (taggings: SceneResource["taggings"]) => {
           icons.push({ ...shape, ...style });
         })
         .catch((e) => {
-          console.error('获取url失败', e, item)
-        })
+          console.error("获取url失败", e, item);
+        }),
     );
   }
 
   await Promise.all(reqs);
-  console.log(texts, images, icons)
   return {
     texts,
     images,
@@ -254,10 +253,10 @@ const getBorderTaggingShapes = (taggings: SceneResource["borderTaggings"]) => {
 
     const w = Math.min(
       taggings[i].points[1].x - taggings[i].points[0].x,
-      textDefaultStyle.fontSize * taggings[i].text.length
-    )
-    const y = taggings[i].center.y - textDefaultStyle.fontSize / 2
-    const x = taggings[i].center.x - w / 2
+      textDefaultStyle.fontSize * taggings[i].text.length,
+    );
+    const y = taggings[i].center.y - textDefaultStyle.fontSize / 2;
+    const x = taggings[i].center.x - w / 2;
 
     const mat = new Transform();
     mat.translate(x, y);
@@ -270,7 +269,7 @@ const getBorderTaggingShapes = (taggings: SceneResource["borderTaggings"]) => {
       mat: mat.m,
       width: w,
       createTime: now + taggings.length + i,
-    }
+    };
     texts.push(text);
   }
   return {
@@ -281,7 +280,7 @@ const getBorderTaggingShapes = (taggings: SceneResource["borderTaggings"]) => {
 
 const getWallTaggingShapes = async (
   taggings: SceneResource["wallTaggings"],
-  lineData: LineData
+  lineData: LineData,
 ) => {
   const lineIcons: LineIconData[] = [];
   const now = Date.now();
@@ -290,10 +289,10 @@ const getWallTaggingShapes = async (
   for (let ndx = 0; ndx < taggings.length; ndx++) {
     const item = taggings[ndx];
     const points = item.pointIds.map(
-      (key) => lineData.points.find((p: any) => p.key === key)!
+      (key) => lineData.points.find((p: any) => p.key === key)!,
     );
     const line = lineData.lines.find(
-      (line) => line.a === points[0].id && line.b === points[1].id
+      (line) => line.a === points[0].id && line.b === points[1].id,
     )!;
     if (!line) {
       break;
@@ -319,7 +318,7 @@ const getWallTaggingShapes = async (
           }
           lineIcons.push({ ...shape, fill: style.fill, stroke: style.stroke });
         })
-        .catch(() => {})
+        .catch(() => {}),
     );
   }
   await Promise.all(reqs);
@@ -329,7 +328,7 @@ const getWallTaggingShapes = async (
 const getDrawResourceOffset = (
   draw: Draw,
   bound: ReturnType<typeof genBound>,
-  thumb?: ImageData
+  thumb?: ImageData,
 ) =>
   new Promise<Pos>((resolve, reject) => {
     ElMessage.warning("请在画图面板中选择放置位置,按右键取消");
@@ -343,7 +342,7 @@ const getDrawResourceOffset = (
 
       stopWatch();
       const item = draw.store.items.find(
-        (item) => item.key === key
+        (item) => item.key === key,
       ) as ImageData;
 
       if (!item) {
@@ -386,9 +385,9 @@ const drawSceneResource = async (resource: SceneResource, draw: Draw) => {
   const { icons, images, texts } = await getTaggingShapes(resource.taggings);
 
   // 这版本的icons先不用 用border
-  const border = getBorderTaggingShapes(resource.borderTaggings)
-  texts.push(...border.texts)
-  const rects = border.rects
+  const border = getBorderTaggingShapes(resource.borderTaggings);
+  texts.push(...border.texts);
+  const rects = border.rects;
 
   const tagShapes = [...icons, ...images, ...texts, thumb];
   tagShapes.forEach((shape) => {
@@ -398,14 +397,14 @@ const drawSceneResource = async (resource: SceneResource, draw: Draw) => {
       bound.update({ x: shape.mat[4], y: shape.mat[5] });
     }
   });
-  const lineShapes = [...rects]
-  lineShapes.forEach(item => {
-    item.points.forEach(p => {
-      p.x += offset.x
-      p.y += offset.y
-      bound.update(p)
-    })
-  })
+  const lineShapes = [...rects];
+  lineShapes.forEach((item) => {
+    item.points.forEach((p) => {
+      p.x += offset.x;
+      p.y += offset.y;
+      bound.update(p);
+    });
+  });
 
   const lineIcons = await getWallTaggingShapes(resource.wallTaggings, geo);
 
@@ -422,7 +421,7 @@ const drawSceneResource = async (resource: SceneResource, draw: Draw) => {
   draw.store.addItems("icon", icons);
   draw.store.addItems("text", texts);
   draw.store.addItems("image", images);
-  draw.store.addItems('rectangle', rects)
+  draw.store.addItems("rectangle", rects);
   if (thumb) {
     draw.store.addItem("image", thumb);
   }
@@ -432,10 +431,13 @@ const drawSceneResource = async (resource: SceneResource, draw: Draw) => {
 
 export const drawPlatformResource = async (
   sceneData: SelectSceneData,
-  draw: Draw
+  draw: Draw,
 ) => {
   // 默认为米,转为厘米
-  const resource = await getResource({ ...sceneData, scale: 1000 * overviewMMToPixel });
+  const resource = await getResource({
+    ...sceneData,
+    scale: 1000 * overviewMMToPixel,
+  });
   let bound = null as ReturnType<ReturnType<typeof genBound>["get"]>;
 
   await draw.history.onceTrack(async () => {
@@ -467,7 +469,7 @@ export const drawPlatformResource = async (
     const viewHeight = Math.max(bound.height, size.height);
     const padding = Math.max(
       Math.min((viewWidth - bound.width) / 2, (viewHeight - bound.height) / 2),
-      40
+      40,
     );
     draw.viewer.setBound({ targetBound: bound, padding });
   }

+ 4 - 2
src/example/platform/resource-swkk.ts

@@ -303,8 +303,10 @@ export const getTraceTaggingInfos = async (
           key: "trace",
           rotate: attr.angle,
           size: {
-            width: attr.size.width * scale,
-            height: attr.size.height * scale,
+            // width: attr.size.width * scale,
+            // height: attr.size.height * scale,
+            width: 40,
+            height: 40
           },
         }))
         .then((info) => infos.push(info))

+ 1 - 1
src/lang/locales/zh.json

@@ -239,7 +239,7 @@
       "name": "线段"
     },
     "lineIcon": {
-      "name": "线段图例",
+      "name": "图例",
       "rever": "翻转"
     },
     "polygon": {