bill 7 місяців тому
батько
коміт
12b7ebac9c

+ 2 - 0
src/app/liantong/example/storeData.json

@@ -122,6 +122,8 @@
       "id": "1722907454861",
       "x": -1.036655172413794,
       "y": -4.342284482758619,
+      "scaleX": 1.3,
+      "scaleY": 1.8,
       "type": "wljg",
       "intersect": true
     },

Різницю між файлами не показано, бо вона завелика
+ 51 - 4
src/app/liantong/icon.ts


+ 36 - 86
src/app/liantong/temp

@@ -1,106 +1,56 @@
 [
   {
-    name: "内墙",
-    type: "Wall",
-    icon: "icon-cad-neiqiang",
-    info: { type: "symbols" },
+    name: "FSU",
+    type: "fsu",
+    icon: "icon-fsu",
+    info: { thickness: 0.042, width: 0.44, height: 0.312 },
   },
   {
-    name: "外墙",
-    type: "OutWall",
-    icon: "icon-cad-waiqiang",
-    info: { type: "symbols" },
+    name: "立式空调",
+    type: "vertical_air_conditioning",
+    icon: "icon-vertical_air_conditioning",
+    info: { thickness: 0.5, width: 0.32, height: 1.85 },
   },
-
   {
-    name: "单开门",
-    type: "SingleDoor",
-    icon: "icon-cad-men",
-    info: { type: "symbols" },
+    name: "地排",
+    type: "floor_drain",
+    icon: "icon-floor_drain",
+    info: { thickness: 0, width: 1, height: 0.05 },
   },
   {
-    name: "双开门",
-    type: "DoubleDoor",
-    icon: "icon-cad-shuangkaimen",
-    info: { type: "symbols" },
+    name: "电源柜",
+    type: "power_supply_cabinet",
+    icon: "icon-pdg",
+    info: { thickness: 0.23, width: 0.12, height: 0.33, distance: 1.5 },
   },
   {
-    name: "移门",
-    type: "SlideDoor",
-    icon: "icon-cad-yimen",
-    info: { type: "symbols" },
+    name: "配电箱",
+    type: "distribution_box",
+    icon: "icon-distribution_box",
+    info: { thickness: 0.15, width: 0.4, height: 0.4, distance: 1.5 },
   },
   {
-    name: "垭口",
-    type: "Pass",
-    icon: "icon-cad-yakou",
-    info: { type: "symbols" },
+    name: "防雷箱",
+    type: "lightning_protection_box",
+    icon: "icon-lightning_protection_box",
+    info: { thickness: 0.12, width: 0.4, height: 0.29, distance: 1.5 },
   },
   {
-    name: "一字窗",
-    type: "SingleWindow",
-    icon: "icon-cad-chuang",
-    info: { type: "symbols" },
+    name: "馈线窗",
+    type: "feeder_window",
+    icon: "icon-feeder_window",
+    info: { thickness: 0.002, width: 0.5, height: 0.4 },
   },
   {
-    name: "一字飘窗",
-    type: "BayWindow",
-    icon: "icon-cad-piaochuang",
-    info: { type: "symbols" },
+    name: "阀控铅酸蓄电池",
+    type: "valve-regulated_lead-acid_battery",
+    icon: "icon-valve-regulated_lead-acid_battery",
+    info: { thickness: 0.78, width: 1, height: 0.5 },
   },
   {
-    name: "落地窗",
-    type: "FrenchWindow",
-    icon: "icon-cad-luodichuang",
-    info: { type: "symbols" },
-  },
-  {
-    name: "柱子",
-    type: "Beam",
-    icon: "icon-cad-zhuzi",
-    info: { type: "symbols" },
-  },
-  {
-    name: "烟道",
-    type: "Flue",
-    icon: "icon-cad-yandao",
-    info: { type: "symbols" },
-  },
-  {
-    name: "楼道",
-    type: "Corridor",
-    icon: "icon-cad-loudao",
-    info: { type: "symbols" },
-  },
-  { name: "电视", type: "TV", icon: "icon-TV", info: { type: "furnitures" } },
-  {
-    name: "组合沙发",
-    type: "CombinationSofa",
-    icon: "icon-CombinationSofa",
-    info: { type: "furnitures" },
-  },
-  {
-    name: "单人沙发",
-    type: "SingleSofa",
-    icon: "icon-SingleSofa",
-    info: { type: "furnitures" },
-  },
-  {
-    name: "茶几",
-    type: "TeaTable",
-    icon: "icon-TeaTable",
-    info: { type: "furnitures" },
-  },
-  {
-    name: "地毯",
-    type: "Carpet",
-    icon: "icon-Carpet",
-    info: { type: "furnitures" },
-  },
-  {
-    name: "餐桌",
-    type: "DiningTable",
-    icon: "icon-DiningTable",
-    info: { type: "furnitures" },
+    name: "铁锂电池",
+    type: "lithium_iron_phosphate_battery",
+    icon: "icon-lithium_iron_phosphate_battery",
+    info: { thickness: 0.78, width: 1, height: 0.5 },
   },
 ]

+ 5 - 6
src/board/packages/poi/edit-poi.ts

@@ -2,7 +2,6 @@ import { Transformer } from "konva/lib/shapes/Transformer";
 import {
   CopyProps,
   copyEntityAttrib,
-  generateId,
   isLineIntersectingPolygon,
 } from "../../shared";
 import { Poi, PoiAttrib } from "./poi";
@@ -46,6 +45,7 @@ export class EditPoi<T extends PoiAttrib = PoiAttrib> extends Poi<T> {
       this.attrib.rotate = dec.rotation;
       this.attrib.scaleX = dec.scaleX;
       this.attrib.scaleY = dec.scaleY;
+
       this.attrib.x = dec.x;
       this.attrib.y = dec.y;
       this.diffRedraw();
@@ -159,13 +159,12 @@ export class EditPoi<T extends PoiAttrib = PoiAttrib> extends Poi<T> {
   }
 
   setSize(size: { w: number; h: number }) {
-    const rect = (this.shape as Group).findOne<Rect>(".rect");
     const origin = {
-      width: rect.width(),
-      height: rect.height(),
+      width: 0.8,
+      height: 0.8 * (800 / 1000),
     };
-    this.attrib.scaleX = origin.width / size.w;
-    this.attrib.scaleY = origin.height / size.h;
+    this.attrib.scaleX = size.w / origin.width;
+    this.attrib.scaleY = size.h / origin.height;
   }
 
   split(axis: "x" | "y") {

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

@@ -7,6 +7,8 @@ type PoiData = {
   y: number;
   intersect?: boolean;
   scaleX?: number;
+  w?: number;
+  h?: number;
   scaleY?: number;
   rotate?: number;
   fontSize?: number;

+ 0 - 1
src/board/shared/act.ts

@@ -123,7 +123,6 @@ export const pathsToActShape = (props: PathsToActShapeProps, test = false) => {
       group.scale({ x: data.scaleX || 1, y: data.scaleY || 1 });
       group.rotation(data.rotate || 0);
       group.position(data);
-      console.log({ ...data });
     },
     common,
   };

+ 0 - 34
tsconfig.prod.json

@@ -1,34 +0,0 @@
-{
-  "compilerOptions": {
-    "target": "es2015",
-    "useDefineForClassFields": true,
-    "module": "ESNext",
-    "lib": [
-      "es2015",
-      "DOM",
-      "DOM.Iterable"
-    ],
-    "skipLibCheck": true,
-    "moduleResolution": "Node",
-    "resolveJsonModule": true,
-    "isolatedModules": true,
-    "jsx": "preserve",
-    "noUnusedLocals": true,
-    "noUnusedParameters": true,
-    "noFallthroughCasesInSwitch": true,
-    "allowImportingTsExtensions": true,
-    "emitDeclarationOnly": true,
-    "declaration": true,
-    "declarationDir": "/Users/bill/word/drawing-board/dist/tempts",
-    "incremental": false
-  },
-  "include": [
-    "/Users/bill/word/drawing-board/src/app/liantong/index.ts",
-    "src/vite-env.d.ts"
-  ],
-  "references": [
-    {
-      "path": "./tsconfig.node.json"
-    }
-  ]
-}