Windows 下改用原生窗口调整方式(#2137)

pull/2148/head
lyswhut 2024-12-02 00:07:00 +08:00
parent 28d0412adc
commit 5d1b1e48d7
5 changed files with 17 additions and 10 deletions

View File

@ -13,6 +13,7 @@ Linux 系统至少需要 GLIBC_2.29 版本才能运行,
- 优化正常播放结束时的下一首歌曲播放衔接度,在歌曲即将播放结束时将预获取下一首歌曲的播放链接,减少自动切歌时的等待时间(#2126
- 优化歌曲换源机制,提升换源正确率
- 优化 Windows 下桌面歌词窗口大小调整机制Windows 下改用原生窗口调整方式(#2137
- 修正搜索歌曲提示框文案(#2050
- 优化播放详情页UI歌曲名字、歌手等文字过长时被截断的问题#2049
- Scheme URL 的播放歌曲允许更长的专辑名称

View File

@ -55,6 +55,7 @@ const winEvent = () => {
browserWindow.on('resize', () => {
// bounds = browserWindow.getBounds()
// console.log(bounds)
isWinBoundsUpdateing = true
const bounds = browserWindow!.getBounds()
saveBoundsConfig({
'desktopLyric.x': bounds.x,
@ -122,7 +123,7 @@ export const createWindow = () => {
hasShadow: false,
// enableRemoteModule: false,
// icon: join(global.__static, isWin ? 'icons/256x256.ico' : 'icons/512x512.png'),
resizable: false,
resizable: isWin,
minimizable: false,
maximizable: false,
fullscreenable: false,

View File

@ -12,14 +12,16 @@
<common-audio-visualizer v-if="setting['desktopLyric.audioVisualization']" />
</transition>
</div>
<div class="resize resize-left" @mousedown.self="handleMouseDown('left', $event)" @touchstart.self="handleTouchDown('left', $event)" />
<div class="resize resize-top" @mousedown.self="handleMouseDown('top', $event)" @touchstart.self="handleTouchDown('top', $event)" />
<div class="resize resize-right" @mousedown.self="handleMouseDown('right', $event)" @touchstart.self="handleTouchDown('right', $event)" />
<div class="resize resize-bottom" @mousedown.self="handleMouseDown('bottom', $event)" @touchstart.self="handleTouchDown('bottom', $event)" />
<div class="resize resize-top-left" @mousedown.self="handleMouseDown('top-left', $event)" @touchstart.self="handleTouchDown('top-left', $event)" />
<div class="resize resize-top-right" @mousedown.self="handleMouseDown('top-right', $event)" @touchstart.self="handleTouchDown('top-right', $event)" />
<div class="resize resize-bottom-left" @mousedown.self="handleMouseDown('bottom-left', $event)" @touchstart.self="handleTouchDown('bottom-left', $event)" />
<div class="resize resize-bottom-right" @mousedown.self="handleMouseDown('bottom-right', $event)" @touchstart.self="handleTouchDown('bottom-right', $event)" />
<template v-if="isShowResize">
<div class="resize resize-left" @mousedown.self="handleMouseDown('left', $event)" @touchstart.self="handleTouchDown('left', $event)" />
<div class="resize resize-top" @mousedown.self="handleMouseDown('top', $event)" @touchstart.self="handleTouchDown('top', $event)" />
<div class="resize resize-right" @mousedown.self="handleMouseDown('right', $event)" @touchstart.self="handleTouchDown('right', $event)" />
<div class="resize resize-bottom" @mousedown.self="handleMouseDown('bottom', $event)" @touchstart.self="handleTouchDown('bottom', $event)" />
<div class="resize resize-top-left" @mousedown.self="handleMouseDown('top-left', $event)" @touchstart.self="handleTouchDown('top-left', $event)" />
<div class="resize resize-top-right" @mousedown.self="handleMouseDown('top-right', $event)" @touchstart.self="handleTouchDown('top-right', $event)" />
<div class="resize resize-bottom-left" @mousedown.self="handleMouseDown('bottom-left', $event)" @touchstart.self="handleTouchDown('bottom-left', $event)" />
<div class="resize resize-bottom-right" @mousedown.self="handleMouseDown('bottom-right', $event)" @touchstart.self="handleTouchDown('bottom-right', $event)" />
</template>
<layout-icons />
</div>
</template>
@ -35,6 +37,7 @@ import useLyric from '@lyric/useApp/useLyric'
import useTheme from '@lyric/useApp/useTheme'
import { init as initLyricPlayer } from '@lyric/core/lyric'
const isShowResize = window.os != 'windows'
useCommon()
const { handleMouseDown, handleTouchDown } = useWindowSize()
const { handleMouseMoveMain, isHoverHide, isMouseEnter } = useHoverHide()

View File

@ -17,7 +17,8 @@
document.documentElement.setAttribute('lang', formatLang(lang))
}
window.setLang()
document.documentElement.classList.add(/os=(\w+)/.exec(window.location.search)[1])
window.os = /os=(\w+)/.exec(window.location.search)[1]
document.documentElement.classList.add(window.os)
window.dom_style_theme = document.createElement('style')
window.dom_style_lyric = document.createElement('style')

View File

@ -11,6 +11,7 @@ declare global {
setTheme: (colors: Record<string, string>) => void
setLang: (lang?: string) => void
setLyricColor: (colors: Record<string, string>) => void
os: 'windows' | 'linux' | 'mac'
}
namespace LX {