Browse Source

律动bug和唱名文件判断修改

黄琪勇 1 month ago
parent
commit
9f297b2d74
2 changed files with 9 additions and 3 deletions
  1. 3 0
      src/state.ts
  2. 6 3
      src/view/rhythm/index.tsx

+ 3 - 0
src/state.ts

@@ -1613,6 +1613,9 @@ const setState = (data: any, index: number) => {
         }else if(state.banSong){
           state.playType = "sing"
           state.playSource = "background"
+        }else if(state.mingSong){
+          state.playType = "sing"
+          state.playSource = "mingSong"
         }
       }
     }else{

+ 6 - 3
src/view/rhythm/index.tsx

@@ -1,6 +1,6 @@
 import { computed, defineComponent, onMounted, ref, watch } from "vue"
 import styles from "./index.module.less"
-import state from "/src/state"
+import state, { IPlatform } from "/src/state"
 import { headTopData } from "/src/page-instrument/header-top"
 
 export default defineComponent({
@@ -77,12 +77,15 @@ export default defineComponent({
             const element = document.querySelector(".rhythmBox-scale-element") as HTMLElement | null
             if (element) {
                const playBtnEl = document.querySelector("#studnetT-7") as HTMLElement | null
+               const playBtnElClac =
+                  playBtnEl?.getBoundingClientRect()?.[state.platform === IPlatform.PC && state.musicScoreBtnDirection === "left" ? "y" : "x"]
+
                const screenWidth = document.documentElement.clientWidth
                const originalWidth = element.offsetWidth
                // 比较差值,需要计算播放按钮的位置
                let distanceWidth = screenWidth
-               if (playBtnEl) {
-                  distanceWidth = screenWidth - (screenWidth - playBtnEl.getBoundingClientRect().left) * 2
+               if (playBtnElClac && playBtnElClac > 0) {
+                  distanceWidth = screenWidth - (screenWidth - playBtnElClac) * 2
                }
                // 保留2位小数
                const scale = distanceWidth < originalWidth ? Math.floor((distanceWidth / originalWidth) * 100) / 100 : 1