فهرست منبع

fix: 修改需求

bill 1 سال پیش
والد
کامیت
1303a0fc44
3فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 1 1
      src/app/liantong/index.ts
  2. 2 0
      src/board/packages/poi/edit-poi.ts
  3. 1 1
      src/board/shared/entity-utils.ts

+ 1 - 1
src/app/liantong/index.ts

@@ -175,7 +175,7 @@ export const createBoard = (
       board.tree.bus.emit("dataChangeBefore");
       const { promise, interrupt } = addEntityAttrib(board.tree, (pos) => {
         const attrib = {
-          id: generateId(pois()),
+          id: Date.now().toString(),
           x: pos[0],
           y: pos[1],
           type,

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

@@ -36,11 +36,13 @@ export class EditPoi<T extends PoiAttrib = PoiAttrib> extends Poi<T> {
   }
 
   copy(props: Pick<CopyProps, "count" | "dire"> = {}) {
+    let i = 0;
     copyEntityAttrib({
       ...props,
       entity: this,
       size: this.actShape.getSize(),
       factoryAttrib: (pos) => ({
+        id: (Date.now() + i++).toString(),
         x: pos[0],
         y: pos[1],
         type: this.attrib.type,

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

@@ -138,8 +138,8 @@ export const copyEntityAttrib = <T extends Entity = Entity>(
     ]).point;
 
     const newAttrib = {
-      ...props.factoryAttrib(point),
       id: generateId(items),
+      ...props.factoryAttrib(point),
     };
     items.push(newAttrib as any);
   }