瀏覽代碼

fix: save

gemercheung 1 年之前
父節點
當前提交
b1a03307b1

+ 7 - 1
packages/qjkankan-editor/src/directives/vTooltipInEditor.js

@@ -8,6 +8,11 @@ function removeTooltip() {
   try {
     intervalId && clearInterval(intervalId);
     tooltipNode && document.body.removeChild(tooltipNode);
+    const allTooltips = document.querySelectorAll(".v-gem-tooltip");
+    // console.log("removeTooltip", allTooltips.length);
+    if (allTooltips.length) {
+      Array.from(allTooltips).map((node) => document.body.removeChild(node));
+    }
   } catch (e) {
     // console.log(
     //   "尝试从DOM上移除tooltip元素失败,通常是因为已经在其他回调中被移除了,不需处理:",
@@ -24,7 +29,9 @@ Vue.directive("tooltip", {
     el.addEventListener(
       "mouseenter",
       function (e) {
+        removeTooltip();
         tooltipNode = document.createElement("div");
+        tooltipNode.className = "v-gem-tooltip";
         tooltipNode.style.position = "fixed";
         tooltipNode.style.zIndex = 2147483647;
         tooltipNode.style.backgroundColor = "#191A1C";
@@ -109,7 +116,6 @@ Vue.directive("tooltip", {
     el.addEventListener("keydown", removeTooltip);
     el.addEventListener("scroll", removeTooltip);
     el.addEventListener("dragstart", removeTooltip);
-    el.addEventListener("dragstart", removeTooltip);
     el.addEventListener("dragleave", removeTooltip);
   },
 });

+ 52 - 19
packages/qjkankan-editor/src/framework/play/pano/index.vue

@@ -237,15 +237,33 @@ export default {
      * 1.6 处理遮罩层
      * @param {*} sky
      */
-    handleSkyCover(sky) {
-      if (sky) {
-        if (sky.isShow) {
-          this.$getKrpano().set("hotspot[peaklogo].visible", true);
-          sky.icon && this.$getKrpano().set("hotspot[peaklogo].url", sky.icon);
-          sky.scale &&
-            this.$getKrpano().set("hotspot[peaklogo].scale", sky.scale);
-        } else {
-          this.$getKrpano().set("hotspot[peaklogo].visible", false);
+    handleSkyCover(skyMask) {
+      // console.log("handleSkyCover", skyMask);
+      if (skyMask) {
+        if ("isShow" in skyMask) {
+          this.$getKrpano().set(
+            `hotspot[peaklogo].visible`,
+            Boolean(skyMask.isShow)
+          );
+        }
+
+        if (skyMask.icon) {
+          this.$getKrpano().set(`hotspot[peaklogo].url`, skyMask.icon);
+        } 
+        if ("scale" in skyMask) {
+          this.$getKrpano().set(`hotspot[peaklogo].scale`, skyMask.scale);
+        }
+        if ("antidistorted" in skyMask) {
+          this.$getKrpano().set(
+            `hotspot[peaklogo].distorted`,
+            skyMask.antidistorted
+          );
+          if (!skyMask.antidistorted) {
+            this.$getKrpano().set(
+              `hotspot[peaklogo].scale`,
+              skyMask.scale * 0.5
+            );
+          }
         }
       }
     },
@@ -253,16 +271,31 @@ export default {
      * 1.6 处理遮罩层
      * @param {*} sky
      */
-    handleEarthCover(earth) {
-      if (earth) {
-        if (earth.isShow) {
-          this.$getKrpano().set("hotspot[nadirlogo].visible", true);
-          earth.icon &&
-            this.$getKrpano().set("hotspot[nadirlogo].url", earth.icon);
-          earth.scale &&
-            this.$getKrpano().set("hotspot[nadirlogo].scale", earth.scale);
-        } else {
-          this.$getKrpano().set("hotspot[nadirlogo].visible", false);
+    handleEarthCover(earthMask) {
+      if (earthMask) {
+        if ("isShow" in earthMask) {
+          this.$getKrpano().set(
+            `hotspot[nadirlogo].visible`,
+            Boolean(earthMask.isShow)
+          );
+        }
+        if (earthMask.icon) {
+          this.$getKrpano().set(`hotspot[nadirlogo].url`, earthMask.icon);
+        }
+        if ("scale" in earthMask) {
+          this.$getKrpano().set(`hotspot[nadirlogo].scale`, earthMask.scale);
+        }
+        if ("antidistorted" in earthMask) {
+          this.$getKrpano().set(
+            `hotspot[nadirlogo].distorted`,
+            earthMask.antidistorted
+          );
+          if (!earthMask.antidistorted) {
+            this.$getKrpano().set(
+              `hotspot[nadirlogo].scale`,
+              earthMask.scale * 0.5
+            );
+          }
         }
       }
     },

+ 10 - 2
packages/qjkankan-editor/src/pages/Edit.vue

@@ -15,9 +15,17 @@ export default {
   computed: {
     ...mapGetters(["isInfoChangedSinceSave"]),
   },
+  watch: {
+    $route() {
+      const allTooltips = document.querySelectorAll(".el-tooltip__popper");
+      if (allTooltips.length) {
+        Array.from(allTooltips).map((node) => document.body.removeChild(node));
+      }
+    },
+  },
   mounted() {
     document.title = this.$i18n.t("gather.editpage_name");
-    window.store = this.$store
+    window.store = this.$store;
     window.addEventListener(
       "beforeunload",
       (e) => {
@@ -30,7 +38,7 @@ export default {
         capture: true,
       }
     );
-    this.$store.dispatch('notice/getNotice')
+    this.$store.dispatch("notice/getNotice");
   },
 };
 </script>

+ 1 - 1
packages/qjkankan-editor/src/views/screen/index.vue

@@ -11,7 +11,7 @@ export default {
   name: "editor-initial-setting",
   components: {
     Setting,
-  }
+  },
 };
 </script>