|
|
|
@ -255,6 +255,7 @@ export class ImageLabel2Component implements OnInit {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//初始化 canvas画布 监听事件
|
|
|
|
|
|
|
|
|
|
initCanvasEvent(canvas) { |
|
|
|
|
let context = canvas.getContext('2d'); |
|
|
|
|
canvas.onmousedown = (e) => { //鼠标按下事件
|
|
|
|
@ -312,6 +313,8 @@ export class ImageLabel2Component implements OnInit {
|
|
|
|
|
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); |
|
|
|
|
context.font = '22px Arial'; |
|
|
|
|
context.fillText('高度:' + element.height, element.x + 3, element.y + 22); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -429,6 +432,8 @@ export class ImageLabel2Component implements OnInit {
|
|
|
|
|
context.strokeStyle = element.oilUnloadingArea ? "green" : "red"; |
|
|
|
|
context.lineWidth = 3; |
|
|
|
|
context.strokeRect(element.x, element.y, element.width, element.height); |
|
|
|
|
context.font = '22px Arial'; |
|
|
|
|
context.fillText('高度:' + element.height, element.x + 3, element.y + 22); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
// console.log(789, pointsList)
|
|
|
|
@ -527,6 +532,7 @@ export class ImageLabel2Component implements OnInit {
|
|
|
|
|
|
|
|
|
|
//canvas 绘制矩形
|
|
|
|
|
drawOblong(oblongList, context) { |
|
|
|
|
console.log('xxxxxxxxxxxxxxxxxxxxxxxxxxi') |
|
|
|
|
context.clearRect(0, 0, this.canvasWidth, this.canvasHeight); |
|
|
|
|
this.copyCanvas ? context.putImageData(this.copyCanvas, 0, 0) : null; |
|
|
|
|
if (this.markType === 2) { //同时绘制 直线箭头
|
|
|
|
@ -537,6 +543,8 @@ export class ImageLabel2Component implements OnInit {
|
|
|
|
|
context.strokeStyle = element.oilUnloadingArea ? "green" : "red"; |
|
|
|
|
context.lineWidth = 3; |
|
|
|
|
context.strokeRect(element.x, element.y, element.width, element.height); |
|
|
|
|
context.font = '22px Arial'; |
|
|
|
|
context.fillText('高度:' + element.height, element.x + 3, element.y + 22); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|