🐞 fix: 播放器展开时可拖拽 #168

This commit is contained in:
imsyy
2024-06-18 09:33:21 +08:00
parent e66ba52889
commit 7d3d7696da
4 changed files with 863 additions and 808 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "splayer",
"version": "2.0.9",
"version": "2.1.0",
"description": "A minimalist music player",
"main": "./out/main/index.js",
"author": "imsyy",
@@ -35,7 +35,7 @@
"colorthief": "^2.4.0",
"electron-dl": "^3.5.2",
"electron-store": "^8.2.0",
"electron-updater": "^6.1.8",
"electron-updater": "^6.2.1",
"express": "^4.19.2",
"express-http-proxy": "^2.0.0",
"font-list": "^1.5.1",
@@ -48,7 +48,7 @@
"pinia-plugin-persistedstate": "^3.2.1",
"plyr": "^3.7.8",
"screenfull": "^6.0.2",
"vue-router": "^4.3.2",
"vue-router": "^4.3.3",
"vue-slider-component": "4.1.0-beta.7"
},
"devDependencies": {
@@ -56,7 +56,7 @@
"@rushstack/eslint-patch": "^1.10.3",
"@vitejs/plugin-vue": "^5.0.5",
"@vue/eslint-config-prettier": "^9.0.0",
"ajv": "^8.15.0",
"ajv": "^8.16.0",
"electron": "^28.3.3",
"electron-builder": "^24.13.3",
"electron-log": "^5.1.5",
@@ -64,12 +64,12 @@
"eslint": "^8.57.0",
"eslint-plugin-vue": "^9.26.0",
"naive-ui": "^2.38.2",
"prettier": "^3.3.0",
"prettier": "^3.3.1",
"sass": "^1.77.4",
"terser": "^5.31.0",
"terser": "^5.31.1",
"unplugin-auto-import": "^0.17.6",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.2.12",
"vite": "^5.2.13",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-pwa": "^0.17.5",
"vue": "3.4.8"

1638
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -58,6 +58,7 @@
<SvgIcon icon="lrc-text" />
</n-icon>
</div>
<div class="center" />
<div class="right">
<!-- 全屏切换 -->
<n-icon class="hidden" @click.stop="screenfullChange">
@@ -440,7 +441,12 @@ onUnmounted(() => {
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.center {
width: 100%;
height: 100%;
flex: 1;
-webkit-app-region: drag;
}
.n-icon {
margin-left: 12px;

View File

@@ -543,8 +543,7 @@ export const setSeek = (seek = 0) => {
* @return {number} seek - 获取的进度值0-1之间的浮点数
*/
export const getSeek = () => {
console.log(player.seek());
if (player) {
if (typeof player !== "undefined") {
return player.seek();
}
return 0;
@@ -584,8 +583,8 @@ const setAudioTime = () => {
const justSetSeek = () => {
if (player?.playing()) {
const status = siteStatus();
const currentTime = player?.seek() || 0;
status.playSeek = currentTime;
status.playSeek = getSeek();
requestAnimationFrame(justSetSeek);
}
};
@@ -838,7 +837,8 @@ export const playAllSongs = async (playlist, mode = "normal") => {
*/
const cleanAllInterval = () => {
clearInterval(seekInterval);
clearInterval(justSeekInterval);
// clearInterval(justSeekInterval);
cancelAnimationFrame(justSeekInterval);
seekInterval = null;
justSeekInterval = null;
};
@@ -850,5 +850,6 @@ const setAllInterval = () => {
cleanAllInterval();
// 启动定时器
seekInterval = setInterval(() => setAudioTime(), 250);
justSeekInterval = setInterval(() => justSetSeek(), 17);
// justSeekInterval = setInterval(() => justSetSeek(), 17);
justSeekInterval = requestAnimationFrame(justSetSeek);
};