浏览代码

loop bug fix

bach 9 月之前
父节点
当前提交
883e7b5896
共有 1 个文件被更改,包括 37 次插入27 次删除
  1. 37 27
      src/components/ConcernementMapItem.vue

+ 37 - 27
src/components/ConcernementMapItem.vue

@@ -68,6 +68,7 @@ export default {
       //
       doleance_transition: false,
       //
+      paperContentsIsSet: false,
 
     }
   },
@@ -217,7 +218,7 @@ export default {
         
         // if map_item is open and we change the mad mode, redefined what is displayed in the "boussole"
         if (this.is_open & n !== o) {
-          this.setPaperContents();
+          this.resetPaperContents();
           this.resetMapItemPosition();
           this.resetMapItemScale();
         }
@@ -843,34 +844,43 @@ export default {
       console.log('setPaperContents');
       // trigered once opening tween is complete
       // trigered once mapmode changed
-      this.clearPaperContents();
-      switch(this.map_mode){
-        case 'terraindevie':
-          this.addNewPaperSymbolInstance('boussole_bg', true);
-          this.paper_main_object.addChild(this.setPaperEntites());
-          // this.setPaperEntitesEvents();
-          break;
-        case 'superposition':
-          this.addNewPaperSymbolInstance('boussole_bg', true);
-          break;
-        case 'proximite':
-          this.addNewPaperSymbolInstance('boussole_bg', true);
-          this.paper_main_object.addChild(this.setPaperEntitesProximiteReferences());
-          break;
-        case 'puissancedagir':
-          this.addNewPaperSymbolInstance('puissanceagir_bg', true);
-          this.paper_main_object.addChild(this.setPaperPuissanceagirBesoins());
-          break;
-        case 'action':
-          this.addNewPaperSymbolInstance('boussole_bg', true);
-          this.paper_main_object.addChild(this.setPaperAgissantes());
-          break;
-        case 'doleancer':
-          this.addNewPaperSymbolInstance('doleance_bg');
-          this.paper_main_object.addChild(this.setPaperDoleances());
-          break;
+      // triggerd when reseting papercontents
+
+      if (!this.paperContentsIsSet) {
+        this.clearPaperContents();
+        switch(this.map_mode){
+          case 'terraindevie':
+            this.addNewPaperSymbolInstance('boussole_bg', true);
+            this.paper_main_object.addChild(this.setPaperEntites());
+            // this.setPaperEntitesEvents();
+            break;
+          case 'superposition':
+            this.addNewPaperSymbolInstance('boussole_bg', true);
+            break;
+          case 'proximite':
+            this.addNewPaperSymbolInstance('boussole_bg', true);
+            this.paper_main_object.addChild(this.setPaperEntitesProximiteReferences());
+            break;
+          case 'puissancedagir':
+            this.addNewPaperSymbolInstance('puissanceagir_bg', true);
+            this.paper_main_object.addChild(this.setPaperPuissanceagirBesoins());
+            break;
+          case 'action':
+            this.addNewPaperSymbolInstance('boussole_bg', true);
+            this.paper_main_object.addChild(this.setPaperAgissantes());
+            break;
+          case 'doleancer':
+            this.addNewPaperSymbolInstance('doleance_bg');
+            this.paper_main_object.addChild(this.setPaperDoleances());
+            break;
+        }
+        this.paperContentsIsSet = true;  
       }
     },
+    resetPaperContents(){
+      this.paperContentsIsSet = false;
+      this.setPaperContents();
+    },
     resetPaperEntitesAndContours(){
       console.log(`concernementMapitem ${this.id} resetPaperEntitesAndContours this.concernement`, this.concernement);
       if (!this.isResetingPaperEntites) {