mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-06-28 05:07:59 +08:00
fix: 画面清晰度
This commit is contained in:
parent
f796e93240
commit
9628d7acb7
@ -990,7 +990,6 @@ export class TextContentParser {
|
||||
data.splitLines.push(this.wordBreak[index]);
|
||||
this.lineHeights.push(this.lineHeight);
|
||||
this.lineWidths.push(this.lineWidth);
|
||||
this.bsStart = index;
|
||||
const text = data.text.slice(
|
||||
this.wordBreak[index] + 1,
|
||||
pointer + 1
|
||||
@ -1002,10 +1001,11 @@ export class TextContentParser {
|
||||
}
|
||||
maxWidth = width;
|
||||
const metrics = ctx.measureText(text);
|
||||
if (metrics.width < maxWidth) {
|
||||
if (metrics.width < maxWidth || index === this.bsStart) {
|
||||
this.lastBreakIndex = index;
|
||||
break;
|
||||
}
|
||||
this.bsStart = index;
|
||||
}
|
||||
this.lineWidth = 0;
|
||||
this.lineStart = pointer;
|
||||
@ -1092,7 +1092,6 @@ export class TextContentParser {
|
||||
data.splitLines.push(this.wordBreak[index]);
|
||||
this.lineHeights.push(this.lineHeight);
|
||||
this.lineWidths.push(this.lineWidth);
|
||||
this.bsStart = index;
|
||||
const text = data.text.slice(this.wordBreak[index] + 1);
|
||||
if (!isLast && text.length < guess / 4) {
|
||||
// 如果剩余文字很少,几乎不可能会单独成一行时,直接结束循环
|
||||
@ -1101,10 +1100,11 @@ export class TextContentParser {
|
||||
}
|
||||
const metrics = ctx.measureText(text);
|
||||
maxWidth = width;
|
||||
if (metrics.width < maxWidth) {
|
||||
if (metrics.width < maxWidth || index === this.bsStart) {
|
||||
this.lastBreakIndex = index;
|
||||
break;
|
||||
}
|
||||
this.bsStart = index;
|
||||
}
|
||||
this.lineWidth = 0;
|
||||
return true;
|
||||
|
@ -628,13 +628,13 @@ export class Layer extends Container<ELayerEvent> {
|
||||
this.size(core._PX_, core._PY_);
|
||||
|
||||
this.staticMap.setHD(false);
|
||||
// this.staticMap.setAntiAliasing(false);
|
||||
this.staticMap.setAntiAliasing(false);
|
||||
this.staticMap.size(core._PX_, core._PY_);
|
||||
this.movingMap.setHD(false);
|
||||
// this.movingMap.setAntiAliasing(false);
|
||||
this.movingMap.setAntiAliasing(false);
|
||||
this.movingMap.size(core._PX_, core._PY_);
|
||||
this.backMap.setHD(false);
|
||||
// this.backMap.setAntiAliasing(false);
|
||||
this.backMap.setAntiAliasing(false);
|
||||
this.backMap.size(core._PX_, core._PY_);
|
||||
this.main.setAntiAliasing(false);
|
||||
this.main.setHD(false);
|
||||
@ -778,11 +778,11 @@ export class Layer extends Container<ELayerEvent> {
|
||||
if (!data) return;
|
||||
|
||||
const frame = data.frame;
|
||||
const temp = this.requireCanvas();
|
||||
const temp = this.requireCanvas(true, false);
|
||||
temp.setHD(false);
|
||||
temp.setAntiAliasing(false);
|
||||
for (let i = 0; i < frame; i++) {
|
||||
const canvas = this.requireCanvas();
|
||||
const canvas = this.requireCanvas(true, false);
|
||||
const ctx = canvas.ctx;
|
||||
const tempCtx = temp.ctx;
|
||||
const [sx, sy, w, h] = data.render[i];
|
||||
@ -1198,7 +1198,7 @@ export class Layer extends Container<ELayerEvent> {
|
||||
const ex = Math.min(sx + blockSize, this.mapWidth);
|
||||
const ey = Math.min(sy + blockSize, this.mapHeight);
|
||||
|
||||
const temp = this.requireCanvas();
|
||||
const temp = this.requireCanvas(true, false);
|
||||
temp.setAntiAliasing(false);
|
||||
temp.setHD(false);
|
||||
temp.size(core._PX_, core._PY_);
|
||||
|
@ -179,7 +179,7 @@ export class Winskin extends RenderItem<EWinskinEvent> {
|
||||
}
|
||||
|
||||
private generatePattern() {
|
||||
const pattern = this.requireCanvas();
|
||||
const pattern = this.requireCanvas(true, false);
|
||||
pattern.setScale(1);
|
||||
const img = this.image;
|
||||
pattern.size(32, 16);
|
||||
|
@ -461,7 +461,11 @@ export abstract class RenderItem<E extends ERenderItemEvent = ERenderItemEvent>
|
||||
*/
|
||||
requireCanvas(alpha: boolean = true, autoScale: boolean = true) {
|
||||
const canvas = new MotaOffscreenCanvas2D(alpha);
|
||||
canvas.setScale(this.scale);
|
||||
if (autoScale) {
|
||||
canvas.setScale(this.scale);
|
||||
} else {
|
||||
canvas.setScale(1);
|
||||
}
|
||||
this.canvases.add(canvas);
|
||||
this.canvasMap.set(canvas, { autoScale });
|
||||
return canvas;
|
||||
|
Loading…
Reference in New Issue
Block a user