Skip to content

Commit 47b14a3

Browse files
committed
feat: support textbox max line and line height
1 parent 129b402 commit 47b14a3

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

packages/webgal/src/Core/util/coreInitialFunction/infoFetcher.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ interface IWebgalConfig {
2121
enableExtra?: boolean; // 启用鉴赏功能
2222
enablePanic?: boolean; // 启用紧急回避
2323
enableLegacyExpressionBlendMode?: boolean; // 启用旧版 Live2D 表情混合模式
24+
textboxMaxLine?: number; // 文字框最大行数
25+
textboxLineHeight?: number; // 文字框行高
2426
}
2527

2628
/**

packages/webgal/src/Stage/TextBox/IMSSTextbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export default function IMSSTextbox(props: ITextboxProps) {
189189

190190
const userDataState = useSelector((state: RootState) => state.userData);
191191
const lineHeightValue = textSizeState === textSize.medium ? 2.2 : 2;
192-
const textLineHeight = userDataState.globalGameVar.LineHeight;
192+
const textLineHeight = userDataState.globalGameVar.textboxLineHeight;
193193
const finalTextLineHeight = textLineHeight ? Number(textLineHeight) : lineHeightValue;
194194
const lineHeightCssStr = `line-height: ${finalTextLineHeight}em`;
195195
const lhCss = css(lineHeightCssStr);

packages/webgal/src/Stage/TextBox/TextBox.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ export const TextBox = () => {
3333
size = getTextSize(stageState.showTextSize) + '%';
3434
textSizeState = stageState.showTextSize;
3535
}
36-
const MaxTextLine = Number(userDataState.globalGameVar.Max_line); // congfig定义字体行数
37-
const lineLimit = Number.isNaN(MaxTextLine)
36+
const maxTextLine = Number(userDataState.globalGameVar.textboxMaxLine); // congfig定义字体行数
37+
const lineLimit = Number.isNaN(maxTextLine)
3838
? match(textSizeState)
3939
.with(textSize.small, () => 3)
4040
.with(textSize.medium, () => 2)
4141
.with(textSize.large, () => 2)
4242
.default(() => 2)
43-
: MaxTextLine;
43+
: maxTextLine;
4444
// 拆字
4545
const textArray = compileSentence(stageState.showText, lineLimit);
4646
const isHasName = stageState.showName !== '';

0 commit comments

Comments
 (0)