-
Notifications
You must be signed in to change notification settings - Fork 1.1k
任务栏歌词微调 #979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kazukokawagawa
wants to merge
4
commits into
dev
Choose a base branch
from
dev-bar
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
任务栏歌词微调 #979
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,6 +92,7 @@ const taskbarConfig = reactive<TaskbarConfig>({ ...DEFAULT_TASKBAR_CONFIG }); | |
| const isFloating = computed(() => route.query.mode === "floating"); | ||
| const isHovering = ref(false); | ||
| const showControls = computed(() => !isFloating.value && isHovering.value); | ||
| let lastMousePassthrough: boolean | null = null; | ||
|
|
||
| /** | ||
| * 只有当 IPC 时间与本地时间误差超过 250ms 时,才同步 IPC 的时间 | ||
|
|
@@ -190,6 +191,14 @@ const handleMouseLeave = () => { | |
| isHovering.value = false; | ||
| }; | ||
|
|
||
| const setMousePassthrough = (ignore: boolean) => { | ||
| const ipc = window.electron?.ipcRenderer; | ||
| if (!ipc) return; | ||
| if (lastMousePassthrough === ignore) return; | ||
| lastMousePassthrough = ignore; | ||
| ipc.send("taskbar:set-ignore-mouse-events", ignore); | ||
| }; | ||
|
|
||
| const controlAction = (action: "playPrev" | "playOrPause" | "playNext") => { | ||
| const ipc = window.electron?.ipcRenderer; | ||
| if (!ipc) return; | ||
|
|
@@ -355,7 +364,7 @@ const updateBgCache = () => { | |
| watch(mainLyricIndex, updateBgCache); | ||
|
|
||
| const displayItems = computed<DisplayItem[]>(() => { | ||
| if (!currentLyricText.value) { | ||
| if (taskbarConfig.hideLyrics || !currentLyricText.value) { | ||
| return createMetadataItems(state.title, state.artist); | ||
| } | ||
|
|
||
|
|
@@ -565,6 +574,15 @@ onMounted(() => { | |
| const ipc = window.electron?.ipcRenderer; | ||
| if (!ipc) return; | ||
|
|
||
| if (isFloating.value) { | ||
| setMousePassthrough(taskbarConfig.floatingLock); | ||
| watch( | ||
| () => taskbarConfig.floatingLock, | ||
| (v) => setMousePassthrough(v), | ||
| { immediate: true }, | ||
| ); | ||
|
Comment on lines
+578
to
+583
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| ipc.on(TASKBAR_IPC_CHANNELS.SYNC_STATE, (_, payload: SyncStatePayload) => { | ||
| switch (payload.type) { | ||
| case "full-hydration": { | ||
|
|
@@ -698,6 +716,7 @@ $radius: 4px; | |
| margin: 5px 0; | ||
| padding: 0 0.9em; | ||
| box-sizing: border-box; | ||
| position: relative; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| display: flex; | ||
| align-items: center; | ||
| justify-content: flex-start; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setMousePassthrough方法与electron/main/windows/floating-taskbar-lyric-window.ts文件中的实现完全相同。这造成了代码重复。为了提高代码的可维护性,建议可以考虑提取一个基类(例如BaseTaskbarLyricWindow)来包含这些共享的方法。