Skip to content

Commit 94b858d

Browse files
authored
Merge pull request #1363 from galacean/refactor/rich-text-max-height-width
fix: unify the rendering size units for rich text and sprite
2 parents e8984e9 + 2d39d1d commit 94b858d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

plugin-packages/rich-text/src/rich-text-layout.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ export class RichTextLayout implements BaseLayout {
6868
this.height = size ? size[1] : 100;
6969

7070
this.wrapEnabled = wrapEnabled;
71-
// 兜底,避免 0/负数/NaN/Infinity
72-
const safeMaxW = Number.isFinite(maxTextWidth) ? maxTextWidth : 0;
73-
const safeMaxH = Number.isFinite(maxTextHeight) ? maxTextHeight : 0;
7471

75-
this.maxTextWidth = Math.max(1, safeMaxW);
76-
this.maxTextHeight = Math.max(1, safeMaxH);
72+
// TODO: 统一富文本和图层 size 单位,这边先临时做个转换
73+
const scaleFactor = 50;
74+
75+
this.maxTextWidth = maxTextWidth * scaleFactor;
76+
this.maxTextHeight = maxTextHeight * scaleFactor;
7777
this.sizeMode = sizeMode;
7878
}
7979

0 commit comments

Comments
 (0)