|
@@ -1,7 +1,7 @@
|
|
|
import { showToast } from "vant";
|
|
|
import { defineComponent, onMounted, reactive } from "vue";
|
|
|
import state from "/src/state";
|
|
|
-import { detailData_gym } from "../../detail";
|
|
|
+import { detailData_gym } from "../../../page-gym/detail";
|
|
|
import request from "/src/utils/request";
|
|
|
import { getQuery } from "/src/utils/queryString";
|
|
|
|
|
@@ -20,10 +20,12 @@ export const moveData = reactive({
|
|
|
|
|
|
function initSvgId() {
|
|
|
const svg = document.querySelector("#osmdSvgPage1");
|
|
|
+ console.log("🚀 ~ svg:", svg);
|
|
|
if (!svg) return;
|
|
|
const vfstavetempo: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-stavetempo"));
|
|
|
const vftext: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-text"));
|
|
|
- const vfstaveSection: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-StaveSection"));
|
|
|
+ console.log("🚀 ~ vftext:", vftext);
|
|
|
+ const vfstaveSection: HTMLElement[] = []//Array.from(svg.querySelectorAll(".vf-StaveSection"));
|
|
|
const vfRepetition: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-Repetition"));
|
|
|
const vflineGroup: HTMLElement[] = Array.from(svg.querySelectorAll(".vf-lineGroup"));
|
|
|
let tempIndex = 1;
|
|
@@ -51,7 +53,6 @@ function initSvgId() {
|
|
|
setEleId(ele, "line" + lineIndex);
|
|
|
lineIndex++;
|
|
|
});
|
|
|
- readerModelBox();
|
|
|
// if (moveData.isWeb) {
|
|
|
// readerModelBox();
|
|
|
// }
|
|
@@ -106,16 +107,26 @@ function formateZoom(n: number) {
|
|
|
}
|
|
|
|
|
|
function createModelBox(ele: SVGAElement) {
|
|
|
- const { left, top, width, height } = getBox(ele);
|
|
|
+ const musicContainer = document.getElementById("musicAndSelection")?.getBoundingClientRect() || { x: 0, y: 0 };
|
|
|
+ const parentLeft = musicContainer.x || 0;
|
|
|
+ const parentTop = musicContainer.y || 0;
|
|
|
+ const noteBbox = ele.getBoundingClientRect();
|
|
|
+ const bbox = {
|
|
|
+ left: noteBbox.x - parentLeft - noteBbox.width / 4 + "px",
|
|
|
+ top: noteBbox.y - parentTop + "px",
|
|
|
+ width: noteBbox.width * 1.5 + "px",
|
|
|
+ height: noteBbox.height + "px",
|
|
|
+ };
|
|
|
const type = ele.getAttribute("class");
|
|
|
moveData.modelList.push({
|
|
|
id: ele.getAttribute("id"),
|
|
|
+ bbox,
|
|
|
type,
|
|
|
isMove: false,
|
|
|
- left,
|
|
|
- top,
|
|
|
- width,
|
|
|
- height,
|
|
|
+ left: noteBbox.left,
|
|
|
+ top: noteBbox.top,
|
|
|
+ width: noteBbox.width,
|
|
|
+ height: noteBbox.height,
|
|
|
x: 0,
|
|
|
y: 0,
|
|
|
zoom,
|
|
@@ -125,24 +136,6 @@ function createModelBox(ele: SVGAElement) {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function readerModelBox() {
|
|
|
- const container = document.querySelector(".moveModelWrap");
|
|
|
- if (!container) return;
|
|
|
- // console.log("🚀 ~ moveData.modelList", moveData.modelList);
|
|
|
- for (let i = 0; i < moveData.modelList.length; i++) {
|
|
|
- const item = moveData.modelList[i];
|
|
|
- const div = document.createElement("div");
|
|
|
- div.classList.add("moveModel");
|
|
|
- div.style.left = item.left + "px";
|
|
|
- div.style.top = item.top + "px";
|
|
|
- div.style.width = item.width + "px";
|
|
|
- div.style.height = item.height + "px";
|
|
|
- div.dataset.id = item.id;
|
|
|
- dragmove(div);
|
|
|
- container.appendChild(div);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
function getBox(ele: SVGAElement) {
|
|
|
if (!ele) return {};
|
|
|
const box = ele.getBBox();
|
|
@@ -421,6 +414,7 @@ export default defineComponent({
|
|
|
setup() {
|
|
|
const query = getQuery();
|
|
|
const isOpen = query.isMove === "1" ? true : false;
|
|
|
+ console.log("🚀 ~ isOpen:", isOpen);
|
|
|
onMounted(() => {
|
|
|
if (isOpen) {
|
|
|
initSvgId();
|
|
@@ -428,6 +422,6 @@ export default defineComponent({
|
|
|
if (detailData_gym.extStyleConfigJson) {
|
|
|
}
|
|
|
});
|
|
|
- return () => <div style={{ display: "none" }}></div>;
|
|
|
+ return () => <div></div>;
|
|
|
},
|
|
|
});
|