Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/webgal/src/Stage/TextBox/IMSSTextbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default function IMSSTextbox(props: ITextboxProps) {

const userDataState = useSelector((state: RootState) => state.userData);
const lineHeightValue = textSizeState === textSize.medium ? 2.2 : 2;
const textLineHeight = userDataState.globalGameVar.LineHeight;
const textLineHeight = userDataState.globalGameVar.Line_height;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

在修改此行的同时,我注意到下一行(193行)可能存在一个潜在问题。当 Line_height 的值为 0 时,textLineHeight ? ... 的判断会为 false,导致回退到默认值 lineHeightValue。然而,0 可能是用户有意设置的有效行高值。为了正确处理这种情况,建议将第193行的判断条件修改为 textLineHeight != null

建议修改为:

const finalTextLineHeight = textLineHeight != null ? Number(textLineHeight) : lineHeightValue;

const finalTextLineHeight = textLineHeight ? Number(textLineHeight) : lineHeightValue;
const lineHeightCssStr = `line-height: ${finalTextLineHeight}em`;
const lhCss = css(lineHeightCssStr);
Expand Down