防止桌面歌词窗口在屏幕分辨率变小时,窗口位置跟随分辨率变化的问题
parent
cf960e3695
commit
3bff44da0c
|
@ -16,6 +16,7 @@
|
|||
- 调整了桌面歌词在启用滚动到顶部时的距离,现在滚动到顶部的歌词更靠边,不再受字体大小、歌词间距影响
|
||||
- 优化更新弹窗内容的显示,添加了自动更新失败时的更新指引
|
||||
- 为所有文本输入框添加右键快速粘贴的功能,右击输入框可以自动粘贴剪贴板的文字,若选中文字时将粘贴并替换选中文字
|
||||
- 防止桌面歌词窗口在屏幕分辨率变小时,窗口位置跟随分辨率变化的问题,现在若屏幕分辨率变小后窗口位置仍会在原始分辨率的位置(添加这个机制是为了解决屏幕分辨率被临时调整时的位置更新问题,如运行某些低分辨率的全屏游戏、高分辨率外接屏幕休眠时),但若你的分辨率调整不是临时的,因窗口在原始位置导致看不到窗口可以开关桌面歌词即可重新自动调节回屏幕内
|
||||
|
||||
### 修复
|
||||
|
||||
|
@ -23,3 +24,4 @@
|
|||
- 修复较旧Linux arm64系统下无法启动软件的问题(将预构建模块的所需glibc版本降级到2.27)(#1161)
|
||||
- 修改列表响应式更新机制,尝试修复偶现的删除歌曲列表未更新的问题
|
||||
- 修复某些kg歌单链接无法打开的问题
|
||||
- 修复将桌面歌词放到屏幕边缘时,偶现的开启桌面歌词后出现歌词窗口位置出现少许偏移的问题,以及将歌词窗口调整到全屏大小后,重开桌面歌词窗口被缩小出现边距的问题
|
||||
|
|
|
@ -9,10 +9,11 @@ import { encodePath } from '@common/utils/electron'
|
|||
// require('./rendererEvent')
|
||||
|
||||
let browserWindow: Electron.BrowserWindow | null = null
|
||||
let isWinBoundsUdating = false
|
||||
|
||||
|
||||
const setLyricsConfig = debounce((config: Partial<LX.AppSetting>) => {
|
||||
const saveBoundsConfig = debounce((config: Partial<LX.AppSetting>) => {
|
||||
global.lx.event_app.update_config(config)
|
||||
if (isWinBoundsUdating) isWinBoundsUdating = false
|
||||
}, 500)
|
||||
|
||||
const winEvent = () => {
|
||||
|
@ -31,21 +32,31 @@ const winEvent = () => {
|
|||
|
||||
browserWindow.on('move', () => {
|
||||
// bounds = browserWindow.getBounds()
|
||||
// console.log(bounds)
|
||||
const bounds = browserWindow!.getBounds()
|
||||
setLyricsConfig({
|
||||
'desktopLyric.x': bounds.x,
|
||||
'desktopLyric.y': bounds.y,
|
||||
'desktopLyric.width': bounds.width,
|
||||
'desktopLyric.height': bounds.height,
|
||||
})
|
||||
// console.log('move', isWinBoundsUdating)
|
||||
if (isWinBoundsUdating) {
|
||||
const bounds = browserWindow!.getBounds()
|
||||
saveBoundsConfig({
|
||||
'desktopLyric.x': bounds.x,
|
||||
'desktopLyric.y': bounds.y,
|
||||
'desktopLyric.width': bounds.width,
|
||||
'desktopLyric.height': bounds.height,
|
||||
})
|
||||
} else {
|
||||
// 非主动调整窗口触发的窗口位置变化将重置回设置值
|
||||
browserWindow!.setBounds({
|
||||
x: global.lx.appSetting['desktopLyric.x'] ?? 0,
|
||||
y: global.lx.appSetting['desktopLyric.y'] ?? 0,
|
||||
width: global.lx.appSetting['desktopLyric.width'],
|
||||
height: global.lx.appSetting['desktopLyric.height'],
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
browserWindow.on('resize', () => {
|
||||
// bounds = browserWindow.getBounds()
|
||||
// console.log(bounds)
|
||||
const bounds = browserWindow!.getBounds()
|
||||
setLyricsConfig({
|
||||
saveBoundsConfig({
|
||||
'desktopLyric.x': bounds.x,
|
||||
'desktopLyric.y': bounds.y,
|
||||
'desktopLyric.width': bounds.width,
|
||||
|
@ -102,6 +113,7 @@ export const createWindow = () => {
|
|||
}
|
||||
|
||||
const { shouldUseDarkColors, theme } = global.lx.theme
|
||||
isWinBoundsUdating = true
|
||||
|
||||
/**
|
||||
* Initial window options
|
||||
|
@ -166,6 +178,7 @@ export const getBounds = (): Electron.Rectangle => {
|
|||
|
||||
export const setBounds = (bounds: Electron.Rectangle) => {
|
||||
if (!browserWindow) return
|
||||
isWinBoundsUdating = true
|
||||
browserWindow.setBounds(bounds)
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,10 @@ export default (db: Database.Database) => {
|
|||
for (const info of result) dbTableMap.set(info.name, info.sql.replace(rxp, ''))
|
||||
return Array.from(tables.entries()).every(([name, sql]) => {
|
||||
const dbSql = dbTableMap.get(name)
|
||||
// if (!(dbSql && dbSql == sql.replace(rxp, ''))) {
|
||||
// console.log('dbSql:', dbSql, '\nsql:', sql.replace(rxp, ''))
|
||||
// }
|
||||
// return true
|
||||
return dbSql && dbSql == sql.replace(rxp, '')
|
||||
})
|
||||
// console.log(dbTableMap)
|
||||
|
|
Loading…
Reference in New Issue