|
@@ -26,7 +26,8 @@
|
|
|
|
|
|
import { SGraphItem, SAnchorItem } from "@persagy-web/graph/lib";
|
|
|
import { Legend } from "./../types/Legend";
|
|
|
-import { SBaseIconTextEdit } from './../../edit/';
|
|
|
+import { SBaseIconTextEdit, SBaseTextEdit } from './../../edit/';
|
|
|
+import { SColor } from '@persagy-web/draw/lib';
|
|
|
|
|
|
|
|
|
* 编辑基础设备类
|
|
@@ -100,7 +101,10 @@ export class SBaseEquipment extends SBaseIconTextEdit {
|
|
|
if (this.legendData.properties && this.legendData.properties.infoPointList) {
|
|
|
const infoPointList = this.legendData.properties.infoPointList
|
|
|
if (infoPointList.length) {
|
|
|
- this.infoPointList = infoPointList
|
|
|
+ this.infoPointList = infoPointList;
|
|
|
+ this.infoPointList.forEach((obj, i) => {
|
|
|
+ this.setTextItem(obj, i)
|
|
|
+ })
|
|
|
} else {
|
|
|
this.infoPointList = []
|
|
|
}
|
|
@@ -124,6 +128,7 @@ export class SBaseEquipment extends SBaseIconTextEdit {
|
|
|
this.selectable = true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
* 设置信息点
|
|
|
*
|
|
@@ -133,6 +138,7 @@ export class SBaseEquipment extends SBaseIconTextEdit {
|
|
|
|
|
|
if (val.checked) {
|
|
|
this._infoPointList.push(val);
|
|
|
+ this.setTextItem(val, (this._infoPointList.length - 1))
|
|
|
} else {
|
|
|
let deleteItemIndex: number = -1;
|
|
|
this._infoPointList.forEach((item, index) => {
|
|
@@ -140,19 +146,42 @@ export class SBaseEquipment extends SBaseIconTextEdit {
|
|
|
deleteItemIndex = index;
|
|
|
}
|
|
|
});
|
|
|
- this._infoPointList.splice(deleteItemIndex, 1)
|
|
|
+ this._infoPointList.splice(deleteItemIndex, 1);
|
|
|
+ this.setTextItem(val, deleteItemIndex)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
- * 增加 textItem
|
|
|
+ * 根据选中状态增加 textItem
|
|
|
*
|
|
|
* @params obj textItem文本信息
|
|
|
+ * @params index 文本索引
|
|
|
*/
|
|
|
- addTextItem(val: any) {
|
|
|
+ setTextItem(val: any, index: number): void {
|
|
|
+ if (val.checked) {
|
|
|
+ let item = new SBaseTextEdit(this, null);
|
|
|
+ item.propertyData = val;
|
|
|
+ item.text = val.name;
|
|
|
+ if (val.pos) {
|
|
|
+ item.moveTo(val.pos.x, val.pos.x)
|
|
|
+ } else {
|
|
|
+ item.moveTo(
|
|
|
+ this.img.width * 0.5,
|
|
|
+ -(this.font.size * 1.25 * 0.5) + (index) * 10
|
|
|
+ );
|
|
|
+ }
|
|
|
+ item.font.size = val.font ? val.font : 12;
|
|
|
+ item.isTransform = false;
|
|
|
+ item.showSelect = false;
|
|
|
+ item.color = item.color ? new SColor(item.color) : new SColor('#000000');
|
|
|
+ this.textItemList.push(item)
|
|
|
+ } else {
|
|
|
+ this.textItemList.splice(index, 1)
|
|
|
+ this.scene?.removeItem(this.textItemList[index]);
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
* 增加 textItem
|