修复 Windows 下桌面歌词最小高度设置问题(#2244)

This commit is contained in:
lyswhut
2025-01-28 19:49:33 +08:00
parent 3e13980870
commit 88e4df4388
4 changed files with 25 additions and 74 deletions
+1 -1
View File
@@ -116,7 +116,7 @@ export const createWindow = () => {
x: winSize.x,
y: winSize.y,
minWidth: 380,
minHeight: 80,
minHeight: 38,
useContentSize: true,
frame: false,
transparent: true,
+6 -4
View File
@@ -1,6 +1,6 @@
// 设置窗口位置、大小
export let minWidth = 80
export let minHeight = 50
export let minHeight = 38
// const updateBounds = (bounds: Bounds) => {
@@ -14,9 +14,11 @@ export let minHeight = 50
* @param param 新设置(相对于当前设置)
* @returns
*/
export const getLyricWindowBounds = (bounds: Electron.Rectangle, { x = 0, y = 0, w = 0, h = 0 }: LX.DesktopLyric.NewBounds): Electron.Rectangle => {
if (w < minWidth) w = minWidth
if (h < minHeight) h = minHeight
export const getLyricWindowBounds = (bounds: Electron.Rectangle, { x = 0, y = 0, w, h }: LX.DesktopLyric.NewBounds): Electron.Rectangle => {
if (w == 0) w = bounds.width
else if (w < minWidth) w = minWidth
if (h == 0) h = bounds.height
else if (h < minHeight) h = minHeight
if (global.lx.appSetting['desktopLyric.isLockScreen']) {
if (!global.envParams.workAreaSize) return bounds
@@ -3,6 +3,7 @@ import { scrollTo } from '@common/utils/renderer'
import { lyric } from '@lyric/store/lyric'
import { isPlay, setting } from '@lyric/store/state'
import { setWindowBounds } from '@lyric/utils/ipc'
import { isWin } from '@common/utils'
const getOffsetTop = (contentHeight, lineHeight) => {
switch (setting['desktopLyric.scrollAlign']) {
@@ -108,12 +109,22 @@ export default (isComputeHeight) => {
dom_lyric.value.scrollTop = msDownScrollY + msDownY - y
startLyricScrollTimeout()
} else if (winEvent.isMsDown) {
setWindowBounds({
x: x - winEvent.msDownX,
y: y - winEvent.msDownY,
w: window.innerWidth,
h: window.innerHeight,
})
// https://github.com/lyswhut/lx-music-desktop/issues/2244
if (isWin) {
setWindowBounds({
x: x - winEvent.msDownX,
y: y - winEvent.msDownY,
w: 0,
h: 0,
})
} else {
setWindowBounds({
x: x - winEvent.msDownX,
y: y - winEvent.msDownY,
w: window.innerWidth,
h: window.innerHeight,
})
}
}
}
const handleMouseMsMove = event => {