|
@@ -46,6 +46,7 @@ export type EntityEvent = {
|
|
mounted: void;
|
|
mounted: void;
|
|
destroyed: void;
|
|
destroyed: void;
|
|
statusChange: Partial<ShapeStylesStatus> | null;
|
|
statusChange: Partial<ShapeStylesStatus> | null;
|
|
|
|
+ updateAttrib: void;
|
|
shapeStatusChange: {
|
|
shapeStatusChange: {
|
|
type?: "click" | "mouse";
|
|
type?: "click" | "mouse";
|
|
current: ShapeStylesStatusKey;
|
|
current: ShapeStylesStatusKey;
|
|
@@ -107,12 +108,17 @@ export abstract class Entity<
|
|
}
|
|
}
|
|
|
|
|
|
setAttrib(newAttrib: Partial<T>) {
|
|
setAttrib(newAttrib: Partial<T>) {
|
|
|
|
+ if (newAttrib.id !== this.attrib.id) {
|
|
|
|
+ console.error("id 确定后无法更改");
|
|
|
|
+ }
|
|
|
|
+
|
|
newAttrib.id = this.attrib.id;
|
|
newAttrib.id = this.attrib.id;
|
|
if (this.props.reactive) {
|
|
if (this.props.reactive) {
|
|
if (toRaw(newAttrib) !== toRaw(this.attrib)) {
|
|
if (toRaw(newAttrib) !== toRaw(this.attrib)) {
|
|
this.attrib = (
|
|
this.attrib = (
|
|
this.props.reactive ? reactive(newAttrib) : newAttrib
|
|
this.props.reactive ? reactive(newAttrib) : newAttrib
|
|
) as T;
|
|
) as T;
|
|
|
|
+ this.bus.emit("updateAttrib");
|
|
this.initReactive();
|
|
this.initReactive();
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -161,6 +167,7 @@ export abstract class Entity<
|
|
|
|
|
|
const parentShape = (tel || this.parent.shape) as Layer;
|
|
const parentShape = (tel || this.parent.shape) as Layer;
|
|
parentShape.add(this.shape);
|
|
parentShape.add(this.shape);
|
|
|
|
+
|
|
this.teleport = parentShape as unknown as ParentShapeType<S>;
|
|
this.teleport = parentShape as unknown as ParentShapeType<S>;
|
|
this.setZIndex(this.zIndex);
|
|
this.setZIndex(this.zIndex);
|
|
|
|
|