bill 1 месяц назад
Родитель
Сommit
89307f7458
2 измененных файлов с 23 добавлено и 15 удалено
  1. 7 2
      src/graphic/Service/SVGService.js
  2. 16 13
      src/store/sync.ts

+ 7 - 2
src/graphic/Service/SVGService.js

@@ -16,10 +16,15 @@ export default class SVGService {
     let SVG = dataService.getSVG(vectorId);
     // let newCenter = uiService.getNewPositionForPop(SVG.center);
     //为了罗敏的需求改动,要求复制出来的svg不重叠
-    let center = { x: SVG.center.x + 100 * SVG.scale, y: SVG.center.y - 100 * SVG.scale };
+
+    const scale = SVG.getScale();
+    let center = {
+      x: SVG.center.x + 100 * scale,
+      y: SVG.center.y - 100 * scale,
+    };
     // let newSVG = this.create(newCenter, SVG.type);
     let newSVG = this.create(center, SVG.type);
-    newSVG.setScale(SVG.scale);
+    // newSVG.setScale(SVG.scale);
     for (let i = 0; i < SVG.points.length; ++i) {
       let dx = SVG.points[i].x - SVG.center.x;
       let dy = SVG.points[i].y - SVG.center.y;

+ 16 - 13
src/store/sync.ts

@@ -310,19 +310,8 @@ export const back = () => {
 
 const loadStore = async () => {
   const data: any = await api.getStore();
-  if (params.temp) {
-    try {
-      const str = await api.getFile("panoReshot.json");
-      const data = await (await fetch(str).then()).text();
-      reshootData.value = JSON.parse(data).map((item) => ({
-        ...item,
-        position: JSON.parse(item.position),
-      }));
-    } catch (e) {
-      console.error(e);
-      reshootData.value = [];
-    }
-  }
+  reshootData.value = [];
+
   list.value = data?.measures || [];
   baseLines.value = data?.baseLines || [];
   basePoints.value = data?.basePoints || [];
@@ -335,6 +324,19 @@ const loadStore = async () => {
   tables.value = data?.tables || {};
   drawSetting.value = data?.drawSetting || {};
   syncSceneStore();
+
+  if (params.temp) {
+    try {
+      const str = await api.getFile("panoReshot.json");
+      const data = await (await fetch(str).then()).text();
+      reshootData.value = JSON.parse(data).map((item) => ({
+        ...item,
+        position: JSON.parse(item.position),
+      }));
+    } catch (e) {
+      console.error(e);
+    }
+  }
 };
 
 export const updateSceneStore = debounce(api.setStore, 300);
@@ -359,6 +361,7 @@ export const downloadImage = async (
 };
 
 const syncSceneStore = () => {
+  console.log("开始监听数据变化");
   return watch(
     () => ({
       measures: list.value,