|
|
|
@ -151,7 +151,7 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* RC版: 该版本已经相当成熟了,基本上不存在导致错误的BUG,与即将发行的正式版相差无几。 |
|
|
|
|
* Release版: 该版本意味“最终版本”,在前面版本的一系列测试版之后,终归会有一个正式版本,是最终交付用户使用的一个版本。该版本有时也称为标准版。一般情况下,Release不会以单词形式出现在软件封面上,取而代之的是符号®。 |
|
|
|
|
*/ |
|
|
|
|
public VERSION = '1.0.11.20210122_beta'; |
|
|
|
|
public VERSION = '1.0.12.20210125_beta'; |
|
|
|
|
/** |
|
|
|
|
* 数据初始化 |
|
|
|
|
*/ |
|
|
|
@ -174,14 +174,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.deleteSelectedShape(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
// 消息系统事件监听
|
|
|
|
|
AxMessageSystem.addListener(CanvasAction.selectionChanged, () => { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
item.showBorder(); |
|
|
|
|
item.drawBorder(1 / this.backgroundImage.scale.x); |
|
|
|
|
item.setPointVisiable(this.allowEdit); |
|
|
|
|
}); |
|
|
|
|
}, this); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 删除选中的图标 |
|
|
|
@ -391,28 +383,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.rectToolGraphics.endFill(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 选中事件 |
|
|
|
|
*/ |
|
|
|
|
this.on('select', (axShape: AxShape) => { |
|
|
|
|
// if (axShape instanceof AxRectangleShape) {
|
|
|
|
|
// let upLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// let upRight: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// let downLeft: PIXI.Sprite= new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// let downRight: PIXI.Sprite = new PIXI.Sprite(this.editorPointTexture);
|
|
|
|
|
// } else {
|
|
|
|
|
axShape.showBorder(); |
|
|
|
|
axShape.drawBorder(1 / this.backgroundImage.scale.x); |
|
|
|
|
axShape.setPointVisiable(this.allowEdit); |
|
|
|
|
// }
|
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 取消选中事件 |
|
|
|
|
*/ |
|
|
|
|
this.on('deselect', (axShape: AxShape) => { |
|
|
|
|
axShape.hideBorder(); |
|
|
|
|
axShape.setPointVisiable(false); |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 创建图标事件(数据处理) |
|
|
|
|
*/ |
|
|
|
@ -451,12 +421,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.emit('canvasDataChanged'); |
|
|
|
|
this.canvasData.isChange = true; |
|
|
|
|
}); |
|
|
|
|
/** |
|
|
|
|
* 删除图标事件(数据处理) |
|
|
|
|
*/ |
|
|
|
|
this.on('deleteIcon', (axShape: AxShape) => { |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 重置画布 |
|
|
|
@ -517,18 +481,6 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置选中 |
|
|
|
|
* 清空所有选择对象,选择ids集合元素 |
|
|
|
|
*/ |
|
|
|
|
public setHighlight(ids: string[]): void { |
|
|
|
|
this.selection.clear(); |
|
|
|
|
ids.forEach(item => { |
|
|
|
|
const obj = this.backgroundImage.getChildByName(item); |
|
|
|
|
this.selection.add(obj); |
|
|
|
|
}); |
|
|
|
|
AxMessageSystem.send(''); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 创建楼层图形 |
|
|
|
|
*/ |
|
|
|
@ -842,22 +794,21 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
event.currentTarget.data = null; |
|
|
|
|
|
|
|
|
|
if (this.rectToolGraphics.visible === true) { |
|
|
|
|
const shapes: AxShape[] = []; |
|
|
|
|
this.backgroundImage.children.forEach(item => { |
|
|
|
|
if ( item instanceof AxImageShape |
|
|
|
|
|| item instanceof MultipointIcon |
|
|
|
|
|| item instanceof PolygonIcon |
|
|
|
|
|| item instanceof AxArrowConnector) { |
|
|
|
|
if ( item instanceof AxShape |
|
|
|
|
&& item instanceof AxPreviewImageShape === false) { |
|
|
|
|
// 判断2个矩形是否相交
|
|
|
|
|
const rect1 = this.rectToolGraphics.getBounds(); |
|
|
|
|
const rect2 = item.getBounds(); |
|
|
|
|
if (this.isOverlap(rect1, rect2)) { |
|
|
|
|
this.selection.add(item); |
|
|
|
|
shapes.push(item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
this.rectToolGraphics.clear(); |
|
|
|
|
this.rectToolGraphics.visible = false; |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
this.selectAll(shapes); |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.on('pointerupoutside', event => { |
|
|
|
@ -1303,12 +1254,13 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
* 粘贴 |
|
|
|
|
*/ |
|
|
|
|
public paste(companyId: string, buildingId: string, floorId: string): void { |
|
|
|
|
const ids: string[] = []; |
|
|
|
|
if (this.copyData.length > 0) { |
|
|
|
|
this.copyData.forEach(item => { |
|
|
|
|
item.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); |
|
|
|
|
const newData = JSON.parse(JSON.stringify(item)); |
|
|
|
|
newData.Id = ObjectID.default.generate(), |
|
|
|
|
newData.CompanyId = companyId; |
|
|
|
|
newData.CompanyId = companyId; |
|
|
|
|
newData.BuildingId = buildingId; |
|
|
|
|
newData.FloorId = floorId; |
|
|
|
|
newData.Point = new PIXI.Point(item.Point.x + 5, item.Point.y + 5); |
|
|
|
@ -1335,9 +1287,9 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
this.selection.add(this.backgroundImage.getChildByName(newData.Id)); |
|
|
|
|
ids.push(newData.Id); |
|
|
|
|
}); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
this.setHighlight(ids); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//////////////////////////////////////////////////////////////////////// 通用/////////////////////////////////////////////////////////////////////////////
|
|
|
|
@ -1434,22 +1386,109 @@ export class WorkingAreaComponent extends EventEmitter implements OnInit, AfterV
|
|
|
|
|
this.setNameVisible(false, 0); |
|
|
|
|
} |
|
|
|
|
//////////////////////////////////////////////////////////////////// 选择逻辑
|
|
|
|
|
// 取消所有选择
|
|
|
|
|
/** |
|
|
|
|
* 清空选择,选择单个形状 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public selectSingle(shape: AxShape) { |
|
|
|
|
if (this.selection.first() !== null) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
} |
|
|
|
|
this.selection.add(shape); |
|
|
|
|
this.setSelectEffect(shape); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 选择 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public select(shape: AxShape) { |
|
|
|
|
if (this.selection.first() !== null |
|
|
|
|
&& !this.isCtrlKeyClicked |
|
|
|
|
&& !this.selection.has(shape)) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
} |
|
|
|
|
this.selection.add(shape); |
|
|
|
|
this.setSelectEffect(shape); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 选择集合中的形状 |
|
|
|
|
* @param shape 形状集合 |
|
|
|
|
*/ |
|
|
|
|
public selectAll(shape: AxShape[]) { |
|
|
|
|
this.selection.addArray(shape); |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.setSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 先清空再选择全部 |
|
|
|
|
* @param shape 形状集合 |
|
|
|
|
*/ |
|
|
|
|
public selectAllWithClear(shape: AxShape[]) { |
|
|
|
|
if (this.selection.first() !== null) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
} |
|
|
|
|
this.selection.addArray(shape); |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
this.setSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 选择集合中所有id的形状 |
|
|
|
|
* @param ids 形状id集合 |
|
|
|
|
*/ |
|
|
|
|
public setHighlight(ids: string[]): void { |
|
|
|
|
const shapes: AxShape[] = []; |
|
|
|
|
// 重新选择
|
|
|
|
|
ids.forEach(item => { |
|
|
|
|
const obj = this.backgroundImage.getChildByName(item); |
|
|
|
|
shapes.push(obj as AxShape); |
|
|
|
|
}); |
|
|
|
|
this.selectAllWithClear(shapes); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 取消所有选择 |
|
|
|
|
*/ |
|
|
|
|
public deselectAll() { |
|
|
|
|
if (this.selection.first() !== null) { |
|
|
|
|
this.selection.all().forEach(item => { |
|
|
|
|
item.hideBorder(); |
|
|
|
|
item.setPointVisiable(false); |
|
|
|
|
this.clearSelectEffect(item); |
|
|
|
|
}); |
|
|
|
|
this.selection.clear(); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// 选择单个
|
|
|
|
|
public selectSingle(obj: any) { |
|
|
|
|
this.deselectAll(); |
|
|
|
|
this.selection.add(obj); |
|
|
|
|
AxMessageSystem.send(CanvasAction.selectionChanged); |
|
|
|
|
/** |
|
|
|
|
* 设置选中效果 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public setSelectEffect(shape: AxShape) { |
|
|
|
|
shape.hideBorder(); |
|
|
|
|
shape.setPointVisiable(false); |
|
|
|
|
shape.showBorder(); |
|
|
|
|
shape.drawBorder(1 / this.backgroundImage.scale.x); |
|
|
|
|
shape.setPointVisiable(this.allowEdit); |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置形状选中效果 |
|
|
|
|
* @param shape 形状 |
|
|
|
|
*/ |
|
|
|
|
public clearSelectEffect(shape: AxShape) { |
|
|
|
|
shape.hideBorder(); |
|
|
|
|
shape.setPointVisiable(false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
enum CanvasAction { |
|
|
|
|