|
@@ -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
|