From 903bf16565560d2014e37bc031baea46ba506ee4 Mon Sep 17 00:00:00 2001 From: 13562321995 <13562321995@163.com> Date: Fri, 29 Apr 2022 15:07:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=A0=A1=E9=AA=8C=E6=A0=87?= =?UTF-8?q?=E7=BB=98=E6=98=AF=E5=90=A6=E5=AE=8C=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../image-label2/image-label2.component.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 f932570..12ee35c 100644 --- a/src/app/system-management/image-label2/image-label2.component.ts +++ b/src/app/system-management/image-label2/image-label2.component.ts @@ -75,11 +75,23 @@ export class ImageLabel2Component implements OnInit { } } if (this.markType === 0) { + if (!this.points.length) { + this.message.create('warning', '绘制完整后可保存!'); + return + } this.camerasData.dimensionedPoints.polygon = this.points } else if (this.markType === 2) { + if (this.arrowPoints.length != 2 || this.oblongPoints.length != 2 || !this.oblongPoints.find(item=>{ return item.oilUnloadingArea }) || !this.oblongPoints.find(item=>{ return !item.oilUnloadingArea })) { + this.message.create('warning', '绘制完整后可保存!'); + return + } this.camerasData.dimensionedPoints.arrow = this.arrowPoints this.camerasData.dimensionedPoints.rectangle = this.oblongPoints } else if (this.markType === 3) { + if (this.arrowPoints.length != 2) { + this.message.create('warning', '绘制完整后可保存!'); + return + } this.camerasData.dimensionedPoints.arrow = this.arrowPoints } let paramsData = JSON.parse(JSON.stringify(this.camerasData)) @@ -213,6 +225,9 @@ export class ImageLabel2Component implements OnInit { context.lineTo(moveX,moveY); context.stroke(); } else { //绘制 矩形 + if (this.oblongPoints.length === 2) { //限制数量 + return + } this.drawOblong(this.oblongPoints,context) context.strokeStyle = this.oilUnloadingArea? "green" : "red"; let element = this.getOblongInfo(this.downx,this.downy,moveX,moveY) @@ -245,6 +260,10 @@ export class ImageLabel2Component implements OnInit { this.arrowPoints.push(point); this.drawLine(this.arrowPoints,context) } else { //绘制 矩形 + if (this.oblongPoints.length === 2) { //限制数量 + this.message.create('warning', '绘制数量已达上限!'); + return + } let point = this.getOblongInfo(this.downx,this.downy,upX,upY) this.oblongPoints.push(point) this.drawOblong(this.oblongPoints,context)