|
@@ -44,10 +44,13 @@ export class TemplateEditor extends Editor {
|
|
|
setState(state: number): void{
|
|
|
this.state = state;
|
|
|
|
|
|
- if(this.state == 9)
|
|
|
+ if(this.state == 9) {
|
|
|
+ this.canvas.style.cursor = "crosshair";
|
|
|
this.tmpMainPipe = new Array<Array<Point>>();
|
|
|
- else
|
|
|
+ } else {
|
|
|
+ this.canvas.style.cursor = "auto";
|
|
|
this.tmpMainPipe = null;
|
|
|
+ }
|
|
|
|
|
|
this.currentTmpMainPipe = null;
|
|
|
this.currentRefPoint = null;
|
|
@@ -364,18 +367,32 @@ export class TemplateEditor extends Editor {
|
|
|
this.editorPart.dynInfo = ViewTool.pointToStr(point);
|
|
|
|
|
|
//重新绘制时,需要考虑关联容器
|
|
|
- let relatedCons: Array<string>;
|
|
|
+ let relatedConIds: Array<string>;
|
|
|
const sel = this.getSelComp();
|
|
|
if(sel && sel.compType == 'mainPipe')
|
|
|
- relatedCons = (<MainPipe>sel).relatedContainers;
|
|
|
- if(relatedCons && relatedCons.length == 0)
|
|
|
- relatedCons = null;
|
|
|
+ relatedConIds = (<MainPipe>sel).relatedContainers;
|
|
|
+ const relCons = [];
|
|
|
+ if(relatedConIds && relatedConIds.length > 0){
|
|
|
+ relatedConIds.forEach(cId => relCons.push(Template.getContainerById(cId, this.templateData)));
|
|
|
+ }
|
|
|
|
|
|
//计算定位参考点
|
|
|
var min: number = Number.MAX_VALUE;
|
|
|
var nearRp: any;
|
|
|
for(const cId in this.refPoints) {
|
|
|
- if(!relatedCons || relatedCons.indexOf(cId) >= 0){
|
|
|
+ let flag = false;
|
|
|
+ if(relCons.length == 0)
|
|
|
+ flag = true;
|
|
|
+ else {
|
|
|
+ const con = Template.getContainerById(cId, this.templateData);
|
|
|
+ for(const rc of relCons) {
|
|
|
+ if(rc == con || Container.isParentOf(rc, con)){
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(flag) {
|
|
|
const rps = this.refPoints[cId];
|
|
|
if(rps && rps.length) {
|
|
|
for(const rp of rps){
|
|
@@ -386,7 +403,7 @@ export class TemplateEditor extends Editor {
|
|
|
nearRp = rp;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
this.currentRefPoint = nearRp;
|