|
@@ -86,6 +86,8 @@ export class TopoScene extends SGraphyScene {
|
|
|
lineType: number = 0;
|
|
|
/** 当前关系item */
|
|
|
relatItem: RelationItem | null = null;
|
|
|
+ /** 设备-关系item统一回调 */
|
|
|
+ callback: Function = (): void => {};
|
|
|
/** */
|
|
|
loadData(data: GraphyData): void {
|
|
|
if (data.equipList && data.equipList.length) {
|
|
@@ -114,9 +116,10 @@ export class TopoScene extends SGraphyScene {
|
|
|
addEquip(equip: Equip): void {
|
|
|
let item = new EquipItem(null, equip);
|
|
|
item.moveTo(equip.Pos.X, equip.Pos.Y);
|
|
|
+ this.click(item);
|
|
|
item.visible = this.isShowEquip;
|
|
|
this.EquipList.push(item);
|
|
|
- if (equip.AnchorList.length) {
|
|
|
+ if (equip.AnchorList && equip.AnchorList.length) {
|
|
|
this.addAllAnchor(item, equip.AnchorList);
|
|
|
}
|
|
|
this.addItem(item);
|
|
@@ -139,6 +142,7 @@ export class TopoScene extends SGraphyScene {
|
|
|
*/
|
|
|
addAnchor(parent: SGraphyItem, anchor: Anchor): void {
|
|
|
let item = new AnchorItem(parent, anchor);
|
|
|
+ this.click(item);
|
|
|
item.visible = this.isShowEquip;
|
|
|
this.AnchorList.push(item);
|
|
|
} // Function addAnchor()
|
|
@@ -158,9 +162,10 @@ export class TopoScene extends SGraphyScene {
|
|
|
/**
|
|
|
* 添加设备item
|
|
|
*/
|
|
|
- addRelation(equip: Relation): void {
|
|
|
- let item = new RelationItem(null, equip);
|
|
|
+ addRelation(rela: Relation): void {
|
|
|
+ let item = new RelationItem(null, rela);
|
|
|
item.visible = this.isShowRelation;
|
|
|
+ this.click(item);
|
|
|
this.RelationList.push(item);
|
|
|
this.addItem(item);
|
|
|
} // Function addRelation()
|
|
@@ -202,6 +207,7 @@ export class TopoScene extends SGraphyScene {
|
|
|
if (anc.parent) {
|
|
|
anc.parent.connect("changePos", item, item.change);
|
|
|
}
|
|
|
+ this.click(item);
|
|
|
this.RelationList.push(item);
|
|
|
this.relatItem = item;
|
|
|
this.grabItem = item;
|
|
@@ -239,6 +245,7 @@ export class TopoScene extends SGraphyScene {
|
|
|
createItem(data: Equip): SGraphyItem {
|
|
|
this.isAdding = true;
|
|
|
this.grabItem = new EquipItem(null, data);
|
|
|
+ this.click(this.grabItem);
|
|
|
return this.grabItem;
|
|
|
} // Function createItem()
|
|
|
|
|
@@ -303,7 +310,7 @@ export class TopoScene extends SGraphyScene {
|
|
|
* 绑定设备右键事件
|
|
|
*
|
|
|
*/
|
|
|
- click(item: SGraphyItem, fn: Function) {
|
|
|
- item.connect("ContextMenu", this, fn);
|
|
|
+ click(item: SGraphyItem): void {
|
|
|
+ item.connect("ContextMenu", this, this.callback);
|
|
|
}
|
|
|
} // Class TopoScene
|