export default class setSamplingPoint { constructor(startX,startY,canvas,ctx,score,id) { this.startX = startX this.startY = startY this.endX = this.startX this.endY = this.startY this.canvas = canvas this.ctx = ctx this.score = score this.id = id this.w = 0 this.h = 0 this.isDrawing = false } setDrawStatus (e) { this.isDrawing = e } getDrawStatus () { return this.isDrawing } draw() { this.ctx.save(); this.ctx.beginPath() this.ctx.font = '20px serif' this.ctx.fillStyle = 'red' this.ctx.textAlign = 'left' this.ctx.textBaseline = 'bottom' this.ctx.fillText(this.score, this.startX, this.startY) this.ctx.fill() this.ctx.closePath() this.ctx.beginPath() this.ctx.font = '45px serif' this.ctx.fillStyle = 'red' this.ctx.textAlign = 'left' this.ctx.textBaseline = 'bottom' // const iconImage = new Image(); // iconImage.src = require('../assets/icon/icon_all_right.png'); // iconImage.onload = () => { // console.log("小图标加载成功"); // // 绘制小图标 // const iconWidth = 40; // 小图标大小 // const iconHeight = 40; // this.ctx.drawImage(iconImage, this.startX, this.startY, iconWidth, iconHeight); // }; this.ctx.fillText('✓', this.startX - 25, this.startY + 5) this.ctx.closePath() this.ctx.restore(); } }