|
|
|
@ -137,7 +137,7 @@ export class GetOutOfLineDetailsComponent implements OnInit {
|
|
|
|
|
this.ctx.fillText( |
|
|
|
|
name, |
|
|
|
|
startPoint[0], |
|
|
|
|
startPoint[1] < 20 ? endPoint[1] + 16 : startPoint[1] |
|
|
|
|
startPoint[1] < 20 ? endPoint[1] + 16 : startPoint[1] - 5 |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -157,6 +157,19 @@ export class GetOutOfLineDetailsComponent implements OnInit {
|
|
|
|
|
this.ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight); |
|
|
|
|
this.strokeRect(this.currentCoordinate); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
downImg() { |
|
|
|
|
const canvasDom: any = document.querySelector("#canvas"); |
|
|
|
|
const imageData = canvasDom.toDataURL("image/png"); //返回base64的URL
|
|
|
|
|
const elink = document.createElement("a"); |
|
|
|
|
elink.download = "图片"; |
|
|
|
|
elink.style.display = "none"; |
|
|
|
|
elink.href = imageData; |
|
|
|
|
document.body.appendChild(elink); |
|
|
|
|
elink.click(); |
|
|
|
|
URL.revokeObjectURL(elink.href); //释放URL对象
|
|
|
|
|
document.body.removeChild(elink); |
|
|
|
|
} |
|
|
|
|
selectedType: string = "img"; |
|
|
|
|
contentType(type) { |
|
|
|
|
this.selectedType = type; |
|
|
|
|