修复windows下界面缩放后移动桌面歌词会改变歌词窗口大小的问题(#2244)

pull/2266/head
lyswhut 2025-02-07 12:54:41 +08:00
parent 691d835d16
commit b80d48aa91
4 changed files with 31 additions and 13 deletions

View File

@ -1,4 +1,5 @@
### 修复
- 修复 Windows 下桌面歌词最小高度设置问题(#2244
- 修复 Windows 下界面缩放后移动桌面歌词会改变歌词窗口大小的问题(#2244
- 修复 tx 歌单搜索名字、描述出现乱码的问题(#2250

View File

@ -14,11 +14,9 @@ export let minHeight = 38
* @param param
* @returns
*/
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
export const getLyricWindowBounds = (bounds: Electron.Rectangle, { x, y, w, h }: LX.DesktopLyric.NewBounds): Electron.Rectangle => {
if (w < minWidth) w = minWidth
if (h < minHeight) h = minHeight
if (global.lx.appSetting['desktopLyric.isLockScreen']) {
if (!global.envParams.workAreaSize) return bounds

View File

@ -22,6 +22,8 @@ export default (isComputeHeight) => {
isMsDown: false,
msDownX: 0,
msDownY: 0,
windowW: 0,
windowH: 0,
}
let msDownY = 0
@ -83,6 +85,8 @@ export default (isComputeHeight) => {
winEvent.isMsDown = true
winEvent.msDownX = x
winEvent.msDownY = y
winEvent.windowW = window.innerWidth
winEvent.windowH = window.innerHeight
}
}
const handleLyricMouseDown = event => {
@ -114,8 +118,8 @@ export default (isComputeHeight) => {
setWindowBounds({
x: x - winEvent.msDownX,
y: y - winEvent.msDownY,
w: 0,
h: 0,
w: winEvent.windowW,
h: winEvent.windowH,
})
} else {
setWindowBounds({

View File

@ -3,6 +3,7 @@ import { scrollXRTo } 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 = (contentWidth, lineWidth) => {
switch (setting['desktopLyric.scrollAlign']) {
@ -21,6 +22,8 @@ export default (isComputeWidth) => {
isMsDown: false,
msDownX: 0,
msDownY: 0,
windowW: 0,
windowH: 0,
}
let msDownX = 0
@ -82,6 +85,8 @@ export default (isComputeWidth) => {
winEvent.isMsDown = true
winEvent.msDownX = x
winEvent.msDownY = y
winEvent.windowW = window.innerWidth
winEvent.windowH = window.innerHeight
}
}
const handleLyricMouseDown = event => {
@ -108,12 +113,22 @@ export default (isComputeWidth) => {
dom_lyric.value.scrollLeft = msDownScrollX + msDownX - x
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: winEvent.windowW,
h: winEvent.windowH,
})
} else {
setWindowBounds({
x: x - winEvent.msDownX,
y: y - winEvent.msDownY,
w: window.innerWidth,
h: window.innerHeight,
})
}
}
}
const handleMouseMsMove = event => {