123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import { CopyProps, copyEntityAttrib } from "../../shared";
- import { Poi, PoiAttrib } from "./poi";
- export class EditPoi<T extends PoiAttrib = PoiAttrib> extends Poi<T> {
- mounted(): void {
- super.enableMouseAct(this.actShape);
- console.log("??");
- super.enableDrag({
- readyHandler: () => {
- this.container.bus.emit("dataChangeBefore");
- },
- moveHandler: (move) => {
- this.attrib.x = move[0];
- this.attrib.y = move[1];
- },
- endHandler: () => {
- this.container.bus.emit("dataChangeAfter");
- },
- });
- }
- del() {
- const pois = this.container.getSameLevelData(this);
- if (pois) {
- pois.splice(pois.indexOf(this.attrib), 1);
- }
- this.container.bus.emit("dataChange");
- }
- copy(props: Pick<CopyProps, "count" | "dire"> = {}) {
- copyEntityAttrib({
- ...props,
- entity: this,
- size: this.actShape.getSize(),
- factoryAttrib: (pos) => ({
- x: pos[0],
- y: pos[1],
- type: this.attrib.type,
- }),
- });
- this.container.bus.emit("dataChange");
- }
- }
|