|
|
|
@ -231,6 +231,7 @@ export class GetOutOfLineDetailsComponent implements OnInit {
|
|
|
|
|
canvasLabel() { |
|
|
|
|
let imgBg: any = document.getElementById("img"); |
|
|
|
|
imgBg.onload = () => { |
|
|
|
|
console.log("图片加载完毕..."); |
|
|
|
|
this.canvasWidth = imgBg.offsetWidth; |
|
|
|
|
this.canvasHeight = imgBg.offsetHeight; |
|
|
|
|
const canvas: any = document.querySelector("#canvas"); |
|
|
|
@ -238,10 +239,11 @@ export class GetOutOfLineDetailsComponent implements OnInit {
|
|
|
|
|
const cWidth = canvas.width, |
|
|
|
|
cHeight = canvas.height; |
|
|
|
|
setTimeout(() => { |
|
|
|
|
console.log("以图画底,描绘预警框..."); |
|
|
|
|
// 以图画底
|
|
|
|
|
this.ctx.drawImage(imgBg, 0, 0, cWidth, cHeight); |
|
|
|
|
this.strokeRect(this.currentCoordinate); |
|
|
|
|
}, 0); |
|
|
|
|
}, 100); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -298,14 +300,6 @@ export class GetOutOfLineDetailsComponent implements OnInit {
|
|
|
|
|
this.ctx.fillRect(startPoint[0], startPoint[1], 10, 10); |
|
|
|
|
this.ctx.fillStyle = this.typeArr[item.id].color; |
|
|
|
|
this.ctx.font = "16px Verdana"; |
|
|
|
|
let name = this.typeArr[item.id].name; |
|
|
|
|
// this.ctx.fillText(
|
|
|
|
|
// name,
|
|
|
|
|
// startPoint[0],
|
|
|
|
|
// startPoint[1] < 20 || item.id === 2 || item.id === 3
|
|
|
|
|
// ? endPoint[1] + 18
|
|
|
|
|
// : startPoint[1] - 5
|
|
|
|
|
// );
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|