bill 9 tháng trước cách đây
mục cha
commit
6b8811678b

+ 0 - 1
src/app/liantong/example/index.vue

@@ -50,7 +50,6 @@ import { svgs } from "../icon";
 
 const poiType = ref(Object.keys(svgs)[0]);
 const rooms = floorDataTransform(floor);
-console.log(rooms);
 changeEnv(false);
 withDefaults(defineProps<{ width?: number; height?: number; pixelRation?: number }>(), {
   width: 320,

+ 2 - 2
src/app/liantong/icon.ts

@@ -210,13 +210,12 @@ export const svgs = {
 
 for (const key in svgs) {
   injectPoiType(key, (attrib, tree) => {
-    console.error(attrib);
     let svgAct: ReturnType<typeof pathsToActShape>;
     if (key === "Tag") {
       const simpleText = new Text({
         name: "rect",
         text: attrib.text || "文本",
-        fontSize: 0.2,
+        fontSize: attrib.fontSize || 0.2,
         fontFamily: "Calibri",
       });
       simpleText.offsetX(simpleText.width() / 2);
@@ -232,6 +231,7 @@ for (const key in svgs) {
           group.position(data);
           group.rotation(data.rotate || 0);
           simpleText.text(data.text || "文本");
+          simpleText.fontSize(data.fontSize || 0.2);
         },
         common() {
           simpleText.fill("#ffffff");

+ 5 - 10
src/app/liantong/index.ts

@@ -141,6 +141,9 @@ export const createBoard = (
   const ret = {
     ...board,
     bus,
+    get store() {
+      return board.getData();
+    },
     setData(data, { angle, center } = { angle: 0, center: new Vector3() }) {
       // console.log(angle, center);
       // center.x = 1.5097999572753906;
@@ -148,25 +151,20 @@ export const createBoard = (
       centerR = center;
       rotationZ = -angle;
       center = new Vector3(-center.x, center.y, -center.z);
-      const id = "Point181";
+      // const id = "Point181";
       setMat
         .identity()
         .multiply(new Matrix3().makeTranslation(-center.x, -center.z))
         .multiply(new Matrix3().makeRotation(rotationZ))
         .multiply(new Matrix3().makeTranslation(center.x, center.z));
-      console.log(data.rooms[0].points.find((p) => p.id === id));
       data = rotateData(data, setMat);
-      console.log(data.rooms[0].points.find((p) => p.id === id));
       return board.setData(data);
     },
     getData() {
       let data = board.getData();
-      const id = "Point181";
-      console.log(data.rooms[0].points.find((p) => p.id === id));
+      // const id = "Point181";
       data = rotateData(data, setMat.clone().invert());
-      console.log(data.rooms[0].points.find((p) => p.id === id));
 
-      console.log("???", data);
       // throw "1";
       return data;
     },
@@ -251,7 +249,6 @@ export const createBoard = (
     showPois() {
       if (!board.tree.entrys.pois) return;
       const pois = board.tree.entrys.pois as Entity[];
-      console.log(pois);
       pois.forEach((poi) => poi.visible(true));
     },
     hidenPois() {
@@ -270,11 +267,9 @@ export const createBoard = (
       pois.forEach((poi) => poi.setShowLabel(false));
     },
     addPoi(type: string) {
-      console.error(type);
       if (!pois()) {
         const data = board.getData();
         data.pois = [];
-        console.log("???");
       }
       board.tree.bus.emit("dataChangeBefore");
       const { promise, interrupt } = addEntityAttrib(board.tree, (pos) => {

+ 1 - 0
src/board/packages/poi/poi.ts

@@ -7,6 +7,7 @@ type PoiData = {
   y: number;
   intersect?: boolean;
   rotate?: number;
+  fontSize?: number;
   text?: string;
   type: string;
 };