diff --git a/src/app/play/Exercises.spreat.ts b/src/app/play/Exercises.spreat.ts index af19454f13bfb364629a707b2c9c8c18bec1d040..92b9c290451a2705bc7e161c53e43a153265e88a 100644 --- a/src/app/play/Exercises.spreat.ts +++ b/src/app/play/Exercises.spreat.ts @@ -188,8 +188,8 @@ export class Exercises { text.fontName = "GOTHIC"; text.boldFontName = 'GOTHICB'; text.textArr = getTextArr(); - text.disH = 20 * this.scaleX; - text.maxWidth = 980 * this.scaleX; + text.disH = 20; + text.maxWidth = 980; text.setScaleXY(this.scaleX); text.refreshSize(); diff --git a/src/app/play/Unit.ts b/src/app/play/Unit.ts index 4c89417fa93e907b6f5634fc3b3cf17122883abd..3cb98f7c0ecce38ea4aa901c3387260e0ff48fe3 100644 --- a/src/app/play/Unit.ts +++ b/src/app/play/Unit.ts @@ -1176,7 +1176,7 @@ export class RichText extends Label { const getBlank = () => { let blank = new Text(); blank.val = ' '; - blank.width = this.ctx.measureText(blank.val).width * this.scaleX; + blank.width = this.ctx.measureText(blank.val).width; return blank; } @@ -1200,13 +1200,13 @@ export class RichText extends Label { else { this.ctx.font = `${this.fontSize}px ${this.fontName}`; } - this.textArr[i].width = this.ctx.measureText(c).width * this.scaleX; + this.textArr[i].width = this.ctx.measureText(c).width; tempStr += text.val; tempArr.push(this.textArr[i]); continue } - if (this.ctx.measureText(temp).width * this.scaleX < w && this.ctx.measureText(temp + (tempStr)).width * this.scaleX <= w) { + if (this.ctx.measureText(temp).width < w && this.ctx.measureText(temp + (tempStr)).width <= w) { temp += ' ' + tempStr; tempArr.push(getBlank()); @@ -1300,17 +1300,18 @@ export class RichText extends Label { for (let b = 0; b < row.length; b++) { let textArr = row[b]; + let temp = ""; for (let i = 0; i < textArr.length; ++i) { - this.ctx.strokeText(textArr[i].val, x, y + (b + 1) * disH); // æ¯è¡Œå—体yåæ ‡é—´éš” - - x += textArr[i].width; + temp += textArr[i].val; } + this.ctx.strokeText(temp, x, y + (b + 1) * disH); // æ¯è¡Œå—体yåæ ‡é—´éš” + x = 0; } } - x = 0; + x = 0;this.ctx.font = `${this.fontSize}px ${this.boldFontName}`; // this.ctx.fillStyle = '#ff7600'; for (let b = 0; b < row.length; b++) {