Skip to content

Commit

Permalink
fix: desktop lyrics are not displayed problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkontoask committed May 28, 2021
1 parent cdfc3d5 commit 4c43b0e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/components/process-bar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ export const ProgressBar = defineComponent({
const visibleTip = ref(false)

const setIndicatorX = (x: number, w: number) => {
const width = toFixed((x / w) * 100, 6)
if (width) {
const format = width > 100 ? 100 : width < 0 ? 0 : width
if (onCurrent?.value) {
if (onCurrent?.value) {
const width = toFixed((x / w) * 100, 6)
if (width) {
const format = width > 100 ? 100 : width < 0 ? 0 : width
onCurrent.value(format)
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/electron/event/ipc-main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export const onIpcMainEvent = (win: BrowserWindow) => {
acceptFirstMouse: true,
skipTaskbar: false,
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
contextIsolation: false,
webSecurity: false
}
})
if (process.env.WEBPACK_DEV_SERVER_URL) {
Expand Down
27 changes: 17 additions & 10 deletions src/pages/footer/sage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,29 @@ export const getters: GetterTree<FooterState, RootState> = {
if (lyric) {
lyric = lyric[0].slice(1).trim()
}
let duration = 0
if (nextTime && time) {
duration = nextTime - time
}
if (index === len - 1 && time) {
duration = allDt - time
}

return {
time: time || 0,
lyric: lyric,
duration: toFixed(duration, 3)
lyric: lyric
}
})
.filter(item => item.time)
.sort((a, b) => a.time - b.time)
return lyrices
return lyrices.map((item, index) => {
const nextTime = lyrices[index + 1]?.time,
time = item.time
let duration = 0
if (nextTime && time) {
duration = nextTime - time
}
if (index === len - 1 && time) {
duration = allDt - time
}
return {
...item,
duration: toFixed(duration, 3)
}
})
},
musicDes(state) {
if (state.music && navigator.onLine) {
Expand Down

0 comments on commit 4c43b0e

Please sign in to comment.