Skip to content

Commit 12a162d

Browse files
committed
✨ feat: 添加歌词背景遮罩
1 parent 54fecbb commit 12a162d

6 files changed

Lines changed: 34 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,18 @@ jobs:
9898
# 构建 Electron App
9999
- name: Build Windows x64 & ARM64 App
100100
if: runner.os == 'Windows'
101-
run: pnpm build:win -- --x64 --arm64 || true
101+
run: pnpm build:win || true
102102
env:
103103
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104104
- name: Build macOS Universal App
105105
if: runner.os == 'macOS'
106-
run: pnpm build:mac -- --x64 --arm64 || true
106+
run: pnpm build:mac || true
107107
shell: bash
108108
env:
109109
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110110
- name: Build Linux x64 & ARM64 App
111111
if: runner.os == 'Linux'
112-
run: pnpm build:linux -- --x64 --arm64 || true
112+
run: pnpm build:linux || true
113113
shell: bash
114114
env:
115115
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

src/assets/data/lyricConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const config: LyricConfig = {
1313
isDoubleLine: true,
1414
position: "both",
1515
limitBounds: false,
16+
textBackgroundMask: false,
1617
};
1718

1819
export default config;

src/components/Setting/LyricsSetting.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,18 @@
526526
@complete="saveDesktopLyricConfig"
527527
/>
528528
</n-card>
529+
<n-card class="set-item">
530+
<div class="label">
531+
<n-text class="name">文本背景遮罩</n-text>
532+
<n-text class="tip" :depth="3">防止在某些界面看不清文本</n-text>
533+
</div>
534+
<n-switch
535+
v-model:value="desktopLyricConfig.textBackgroundMask"
536+
:round="false"
537+
class="set"
538+
@update:value="saveDesktopLyricConfig"
539+
/>
540+
</n-card>
529541
<n-card class="set-item">
530542
<div class="label">
531543
<n-text class="name">恢复默认配置</n-text>

src/layout/AppLayout.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ const contentRef = ref<HTMLElement | null>(null);
9191
// 主内容高度
9292
const { height: contentHeight } = useElementSize(contentRef);
9393
94+
// 离开前提醒
95+
window.addEventListener("beforeunload", (event) => {
96+
event.preventDefault();
97+
event.returnValue = "";
98+
});
99+
94100
watchEffect(() => {
95101
statusStore.mainContentHeight = contentHeight.value;
96102
});

src/types/desktop-lyric.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export interface LyricConfig {
4747
position: "left" | "center" | "right" | "both";
4848
/** 是否限制在屏幕边界内拖动 */
4949
limitBounds: boolean;
50+
/** 文本背景遮罩 */
51+
textBackgroundMask: boolean;
5052
}
5153

5254
/**

src/views/DesktopLyric/index.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
{
6565
active: line.active,
6666
'is-yrc': Boolean(lyricData?.yrcData?.length && line.line?.words?.length > 1),
67+
'has-background-mask': lyricConfig.textBackgroundMask,
6768
},
6869
]"
6970
:style="{
@@ -745,6 +746,15 @@ onBeforeUnmount(() => {
745746
overflow: hidden;
746747
text-overflow: ellipsis;
747748
white-space: nowrap;
749+
position: relative;
750+
&.has-background-mask {
751+
.scroll-content {
752+
background-color: rgba(0, 0, 0, 0.5);
753+
border-radius: 6px;
754+
padding: 2px 8px;
755+
display: inline-block;
756+
}
757+
}
748758
.scroll-content {
749759
display: inline-block;
750760
white-space: nowrap;

0 commit comments

Comments
 (0)