@@ -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,
@@ -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(),
type: this.attrib.type,
@@ -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);