Browse Source

[完善]错误框区域左上角增加色块

master
邵佳豪 2 years ago
parent
commit
45406d5f28
  1. 4
      src/app/pages/get-out-of-line-details/get-out-of-line-details.component.html
  2. 10
      src/app/pages/get-out-of-line-details/get-out-of-line-details.component.scss
  3. 11
      src/app/pages/get-out-of-line-details/get-out-of-line-details.component.ts

4
src/app/pages/get-out-of-line-details/get-out-of-line-details.component.html

@ -31,12 +31,12 @@
<img id="img" [src]="imgUrl" alt="" (error)="imgErr()">
<canvas *ngIf="isAnxin" [width]="canvasWidth" [height]="canvasHeight"
[ngStyle]="{'width': canvasWidth + 'px','height': canvasHeight + 'px'}" id="canvas"></canvas>
<span *ngIf="isSrcError">
<span *ngIf="isSrcError" class="SrcError">
图片资源未找到
</span>
</ng-container>
<ng-template #elseTemplate>
暂无图片
<span class="SrcError">暂无图片</span>
</ng-template>
</div>
<div *ngIf="selectedType == 'video'" class="vediobox">

10
src/app/pages/get-out-of-line-details/get-out-of-line-details.component.scss

@ -65,7 +65,8 @@
.typecheckbox {
box-sizing: border-box;
padding: 0 12px;
margin-bottom:6px;
margin-bottom: 6px;
label {
color: #fff;
}
@ -101,6 +102,13 @@
max-width: 100%;
max-height: 100%;
}
.SrcError {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
.imgboxAX {

11
src/app/pages/get-out-of-line-details/get-out-of-line-details.component.ts

@ -69,6 +69,7 @@ export class GetOutOfLineDetailsComponent implements OnInit {
if (!this.legendList.some((e) => e.id == checkboxArr[i].id))
this.legendList.push(checkboxArr[i]);
}
this.details = this.data.content1;
this.imgUrl = this.data.violateImage;
this.vedioUrl = this.data.violateVideo;
@ -122,6 +123,16 @@ export class GetOutOfLineDetailsComponent implements OnInit {
endPoint[0] - startPoint[0],
endPoint[1] - startPoint[1]
);
//如果当前矩形区域为错误区域,则左上角增加色块
if (item.error) {
this.ctx.fillStyle = this.typeArr[item.id].color;
this.ctx.fillRect(
startPoint[0],
startPoint[1],
10,
10
);
}
this.ctx.fillStyle = this.typeArr[item.id].color;
this.ctx.font = "16px Verdana";
let name = "";

Loading…
Cancel
Save