import { Attrib, CustomizeShape, ShapeType } from "../../type"; import { Entity, EntityProps } from "../entity"; import { defaultPoiShapeFactory, poiTypes } from "./types"; type PoiData = { x: number; y: number; type: string; }; export type PoiAttrib = Attrib & PoiData; export class Poi extends Entity { static namespace = "poi"; constructor(props: EntityProps) { props.zIndex = props.zIndex || 5; props.name = props.name || Poi.namespace + props.attrib.id; super(props); } actShape: CustomizeShape number[] }>; initShape() { const factory = poiTypes[this.attrib.type] || defaultPoiShapeFactory; this.actShape = factory(this.attrib, this); return this.actShape.shape; } diffRedraw() { this.actShape.setData(this.attrib); } mounted(): void { super.mounted(); this.actShape.common(null); } }