瀏覽代碼

fix: 添加定制需求

bill 1 年之前
父節點
當前提交
549e891c0f

+ 13 - 0
src/app/liantong/index.ts

@@ -58,6 +58,19 @@ export const createBoard = (
         rooms: [{ id: "0", points: [], polygons: [], lines: [] }],
         pois: [],
       } as any);
+      board.history.clear();
+    },
+    hidenPois() {
+      const pois = board.tree.entrys.pois as Entity[];
+      pois.forEach((poi) => {
+        poi.shape.hide();
+      });
+    },
+    showPois() {
+      const pois = board.tree.entrys.pois as Entity[];
+      pois.forEach((poi) => {
+        poi.shape.show();
+      });
     },
     addPoi(type: string) {
       board.tree.bus.emit("dataChangeBefore");

+ 6 - 1
src/board/packages/whole-line/editable/edit-whole-line.ts

@@ -213,10 +213,15 @@ export class EditWholeLine<
         const pointsArray = polygons.map(({ polygonId }) => {
           let points = getWholeLinePolygonPoints(this.attrib, polygonId);
           const startNdx = points.indexOf(attrib);
+          const end =
+            points[0] === points[points.length - 1]
+              ? points.length - 1
+              : points.length;
           points = [
-            ...points.slice(startNdx + 1, points.length - 1),
+            ...points.slice(startNdx + 1, end),
             ...points.slice(0, startNdx),
           ];
+          console.log(points);
           return points.map((point) => [point.x, point.y]);
         });
         return pointsArray;

+ 4 - 0
src/board/plugins/history-plugin.ts

@@ -61,6 +61,10 @@ export class HistoryPlugin<T = any> {
     }
   }
 
+  clear() {
+    this.history.reset();
+  }
+
   private timelyPushDestory: () => void;
   private timelyPush() {
     this.timelyPushDestory && this.timelyPushDestory();

+ 12 - 6
src/board/shared/adsorb.ts

@@ -188,8 +188,8 @@ export const getAdsorbSelfLinesPosition = ({
   angle,
 }: AdsorbSelfLinesProps) => {
   if (!points?.length) return;
-  // 当前位置始终在第一个点
 
+  // 当前位置始终在第一个点
   const last = points.slice(0, 2).flatMap((a) => a);
   const first = points
     .slice(points.length - 2, points.length)
@@ -200,14 +200,20 @@ export const getAdsorbSelfLinesPosition = ({
     createLineByDire(getVerticaLineDire(first), [first[2], first[3]], 10),
   ];
 
-  // 垂直最后一段
-  return (
-    getAdsorbLinePositionRaw({
+  // 垂直前后
+  let aposition;
+  if (
+    (aposition = getAdsorbLinePositionRaw({
       position,
       refLines: vlines,
       angle,
-    }) || position
-  );
+    }))
+  ) {
+    return aposition;
+  }
+
+  // 垂直自身连接
+  // position
 };
 
 export type AdsorbProps = Omit<

+ 2 - 2
src/board/shared/entity-utils.ts

@@ -7,7 +7,7 @@ import { getTouchOffset } from "./act";
 import { createLineByDire, getDireDist } from "./math";
 import { inRevise } from "./public";
 import { disableMouse, enableMouse } from "./shape-mose";
-import { generateId, getChangeAllPoart, getChangePart } from "./util";
+import { generateId, getChangePart } from "./util";
 
 const getExtendsProps = (parent: Entity<any, any>) => {
   return parent
@@ -109,7 +109,7 @@ export const incEntitysFactoryGenerate = <
     return {
       adds,
       dels,
-      upds,
+      upds: [],
     };
   };
 };

+ 3 - 0
src/components/query-board/index.vue

@@ -22,6 +22,9 @@
     <template v-if="addPoiState">
       <ElButton @click="addPoiState.cancel()"> 停止添加poi </ElButton>
     </template>
+
+    <ElButton @click="board.showPois()"> 显示图例 </ElButton>
+    <ElButton @click="board.hidenPois()"> 隐藏图例 </ElButton>
   </div>
   <div
     class="board-layout"