|
@@ -82,13 +82,21 @@ export class TemplateEditor extends Editor {
|
|
|
let color = "#5783FA";
|
|
|
if(item.bindEquipment)
|
|
|
color = "#000000";
|
|
|
- this.ctx.strokeStyle = color;
|
|
|
- this.ctx.setLineDash([]);
|
|
|
- if(this.getSelComp() == item)
|
|
|
- this.ctx.lineWidth = 2;
|
|
|
- else
|
|
|
- this.ctx.lineWidth = 1;
|
|
|
+ let lw = 1;
|
|
|
+ let ld = [];
|
|
|
+
|
|
|
+ if(this.getSelComp() == item) {
|
|
|
+ lw = 2;
|
|
|
+ if(this.tmpMainPipe) {
|
|
|
+ ld = [5, 5];
|
|
|
+ color = '#ff5500';
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ this.ctx.strokeStyle = color;
|
|
|
+ this.ctx.lineWidth = lw;
|
|
|
+ this.ctx.setLineDash(ld);
|
|
|
+
|
|
|
this.ctx.beginPath();
|
|
|
for(const arr of item.locationPath){
|
|
|
var iter = 0;
|
|
@@ -360,20 +368,30 @@ export class TemplateEditor extends Editor {
|
|
|
|
|
|
this.editorPart.dynInfo = ViewTool.pointToStr(point);
|
|
|
|
|
|
+
|
|
|
+ let relatedCons: Array<string>;
|
|
|
+ const sel = this.getSelComp();
|
|
|
+ if(sel.compType == 'mainPipe')
|
|
|
+ relatedCons = (<MainPipe>sel).relatedContainers;
|
|
|
+ if(relatedCons && relatedCons.length == 0)
|
|
|
+ relatedCons = null;
|
|
|
+
|
|
|
|
|
|
var min: number = Number.MAX_VALUE;
|
|
|
var nearRp: any;
|
|
|
for(const cId in this.refPoints) {
|
|
|
- const rps = this.refPoints[cId];
|
|
|
- if(rps && rps.length) {
|
|
|
- for(const rp of rps){
|
|
|
- const p1 = rp.location;
|
|
|
- const distance = Math.sqrt(Math.pow(p1.x - point.x, 2) + Math.pow(p1.y - point.y, 2));
|
|
|
- if(distance < min) {
|
|
|
- min = distance;
|
|
|
- nearRp = rp;
|
|
|
+ if(!relatedCons || relatedCons.indexOf(cId) >= 0){
|
|
|
+ const rps = this.refPoints[cId];
|
|
|
+ if(rps && rps.length) {
|
|
|
+ for(const rp of rps){
|
|
|
+ const p1 = rp.location;
|
|
|
+ const distance = Math.sqrt(Math.pow(p1.x - point.x, 2) + Math.pow(p1.y - point.y, 2));
|
|
|
+ if(distance < min) {
|
|
|
+ min = distance;
|
|
|
+ nearRp = rp;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
this.currentRefPoint = nearRp;
|