From 3073311e88e20afbdb8c21fda85e2975fd0666af Mon Sep 17 00:00:00 2001 From: cpfcls <1105965053@qq.com> Date: Thu, 14 Apr 2022 11:09:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=B8=A4=E7=A7=8D=E7=BB=98?= =?UTF-8?q?=E5=88=B6=E5=8A=9F=E8=83=BD=E6=95=B0=E6=8D=AE=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../image-label2/image-label2.component.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/system-management/image-label2/image-label2.component.ts b/src/app/system-management/image-label2/image-label2.component.ts index fdd9424..d9f498e 100644 --- a/src/app/system-management/image-label2/image-label2.component.ts +++ b/src/app/system-management/image-label2/image-label2.component.ts @@ -143,6 +143,7 @@ export class ImageLabel2Component implements OnInit { context.stroke(); } else { //绘制 矩形 this.drawOblong(this.oblongPoints,context) + context.strokeStyle = this.oilUnloadingArea? "green" : "red"; let element = this.getOblongInfo(this.downx,this.downy,moveX,moveY) context.strokeRect(element.x,element.y,element.width,element.height); } @@ -180,9 +181,16 @@ export class ImageLabel2Component implements OnInit { arrowPoints = []; //箭头的点的集合 //canvas 绘制直线 - drawLine(pointsList, context) { + drawLine(pointsList, context, isRepeat: boolean = false) { context.clearRect(0, 0, this.canvasWidth, this.canvasHeight); this.copyCanvas? context.putImageData(this.copyCanvas, 0, 0) : null; + if (this.markType === 3 && !isRepeat) { //同时绘制 矩形 + this.oblongPoints.forEach(element => { + context.strokeStyle = element.oilUnloadingArea? "green" : "red"; + context.lineWidth = 3; + context.strokeRect(element.x,element.y,element.width,element.height); + }); + } pointsList.forEach((item,index)=>{ if ((index+1)%2 === 0) { this.drawArrow(item.startX,item.startY,item.endX,item.endY,30,10,3,'green',context) @@ -273,8 +281,11 @@ export class ImageLabel2Component implements OnInit { drawOblong(oblongList, context) { context.clearRect(0, 0, this.canvasWidth, this.canvasHeight); this.copyCanvas? context.putImageData(this.copyCanvas, 0, 0) : null; + if (this.markType === 3) { //同时绘制 直线箭头 + this.drawLine(this.arrowPoints,context,true) + } oblongList.forEach(element => { - context.strokeStyle = "green"; + context.strokeStyle = element.oilUnloadingArea? "green" : "red"; context.lineWidth = 3; context.strokeRect(element.x,element.y,element.width,element.height); });