Skip to content

Commit

Permalink
修正浮点数造成无法正常导出保存的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-xmh committed Feb 22, 2024
1 parent 8a6fa78 commit 9339c6c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/LyricSyncEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ useKeyBinding(settings.keybindings.seekRightWord, () => {
useKeyBinding(settings.keybindings.setCurWordStartTime, (evt: KeyBindingEvent) => {
const curWord = getCurrentWord();
if (curWord) {
const time = currentTimeMS.value + settings.timeOffset - evt.downTimeOffset;
const time = currentTimeMS.value + settings.timeOffset - Math.round(evt.downTimeOffset);
curWord.startTime = time;
if ((curWord.emptyBeat ?? 0) > 0) currentWord.emptyBeat = 1;
const currentLine = getCurrentLine();
Expand All @@ -254,7 +254,7 @@ function stepWordAndSetTime(evt: KeyBindingEvent) {
const currentLine = getCurrentLine();
const curWordIndex = currentWord.wordIndex;
if (moveRight()) {
const time = currentTimeMS.value + settings.timeOffset - evt.downTimeOffset;
const time = currentTimeMS.value + settings.timeOffset - Math.round(evt.downTimeOffset);
let shouldRecord = false;
if (curWord) {
curWord.endTime = time;
Expand Down Expand Up @@ -298,7 +298,7 @@ useKeyBinding(settings.keybindings.stepWordAndSetEndTime, (evt) => {
const curWordIndex = currentWord.wordIndex;
if (moveRight()) {
if (curWord) {
curWord.endTime = currentTimeMS.value + settings.timeOffset - evt.downTimeOffset;
curWord.endTime = currentTimeMS.value + settings.timeOffset - Math.round(evt.downTimeOffset);
if (currentLine && curWordIndex === currentLine.words.length - 1) {
currentLine.endTime = curWord.endTime;
}
Expand Down

0 comments on commit 9339c6c

Please sign in to comment.