Skip to content

Commit

Permalink
修正预览模式不能正确设置单词渐变宽度的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-xmh committed Nov 27, 2024
1 parent 2205e36 commit e78fa0c
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/components/RibbonBar/preview-mode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,11 @@
* https://github.com/Steve-xmh/amll-ttml-tool/blob/main/LICENSE
*/

import {
lyricWordFadeWidthAtom,
showRomanLinesAtom,
showTranslationLinesAtom,
} from "$/states/preview.ts";
import { Checkbox, Grid, Text, TextField } from "@radix-ui/themes";
import { useAtom } from "jotai";
import { forwardRef } from "react";
import { RibbonFrame, RibbonSection } from "./common";
import {lyricWordFadeWidthAtom, showRomanLinesAtom, showTranslationLinesAtom,} from "$/states/preview.ts";
import {Checkbox, Grid, Text, TextField} from "@radix-ui/themes";
import {useAtom} from "jotai";
import {forwardRef} from "react";
import {RibbonFrame, RibbonSection} from "./common";

export const PreviewModeRibbonBar = forwardRef<HTMLDivElement>(
(_props, ref) => {
Expand Down Expand Up @@ -61,8 +57,13 @@ export const PreviewModeRibbonBar = forwardRef<HTMLDivElement>(
style={{
width: "4em",
}}
value={lyricWordFadeWidth}
onChange={(e) => setLyricWordFadeWidth(e.target.valueAsNumber)}
defaultValue={lyricWordFadeWidth}
onBlur={(e) => {
const value = Number.parseFloat(e.target.value);
if (Number.isFinite(value)) {
setLyricWordFadeWidth(value);
}
}}
/>
</Grid>
</RibbonSection>
Expand Down

0 comments on commit e78fa0c

Please sign in to comment.