浏览代码

fix: 谱面编辑功能问题修改

TIANYONG 9 月之前
父节点
当前提交
6c58640703
共有 3 个文件被更改,包括 11 次插入4 次删除
  1. 1 0
      src/state.ts
  2. 4 0
      src/style.css
  3. 6 4
      src/view/plugins/move-music-score/index.tsx

+ 1 - 0
src/state.ts

@@ -2106,6 +2106,7 @@ export const checkMoveNoSave = async () => {
     if (query.isMove) {
       if (moveData.open && undoData.undoList.length) {
         showConfirmDialog({
+          className: "noSaveModal",
           title: "温馨提示",
           message: "您有新的修改还未保存,切换谱面后本次编辑的内容将不会保存",
         }).then(() => {

+ 4 - 0
src/style.css

@@ -123,6 +123,10 @@ body {
   transition: all 0.3s;
 }
 
+.noSaveModal {
+  transform: scale(0.8) translateY(-50%);
+}
+
 /* 引导动画 */
 @keyframes guideKeyframes {
   0% {

+ 6 - 4
src/view/plugins/move-music-score/index.tsx

@@ -89,6 +89,7 @@ function initSvgId() {
 	});
 	let textIndex = 1;
 	[...vftext].forEach((ele) => {
+		// console.log(ele.textContent,textIndex)
 		setEleId(ele, "text" + textIndex);
 		textIndex++;
 	});
@@ -121,10 +122,10 @@ function setEleId(ele: HTMLElement, eleId: string) {
 	if (!id) {
 		ele.setAttribute("id", eleId);
 	}
-	createModelBox(ele as any);
+	createModelBox(ele as any, eleId as any);
 }
 
-function createModelBox(ele: SVGAElement) {
+function createModelBox(ele: SVGAElement, eleId?: any) {
 	const musicContainer = document.getElementById("musicAndSelection")?.getBoundingClientRect() || { x: 0, y: 0 };
 	const parentLeft = musicContainer.x || 0;
 	const parentTop = musicContainer.y || 0;
@@ -137,7 +138,7 @@ function createModelBox(ele: SVGAElement) {
 	};
 	const type = ele.getAttribute("class");
 	moveData.modelList.push({
-		id: ele.getAttribute("id"),
+		id: eleId || ele.getAttribute("id"),
 		bbox,
 		type,
 		isMove: false,
@@ -173,6 +174,7 @@ const switchMoveState = () => {
 	// 如果编辑过,没有保存,点击取消状态,需要提醒用户是否取消
 	if (moveData.open && undoData.undoList.length) {
 		showConfirmDialog({
+			className: "noSaveModal",
 			title: "温馨提示",
 			message: "您有新的修改还未保存,取消后本次编辑的内容将不会保存",
 		}).then(() => {
@@ -541,7 +543,7 @@ export const renderForMoveData = () => {
 					// index = targetIndex + 1
 					// item.id = `text${index}`
 					index = targetIndex
-					item.id = `text${targetIndex+1}`
+					item.id = `text${targetIndex}`
 				}
 				// console.log(66666666,index)
 				if (index > -1) {