From 883e7b58967cb43e2ba5fc52ef5259833863b0b8 Mon Sep 17 00:00:00 2001 From: bach Date: Mon, 3 Jun 2024 13:06:25 +0200 Subject: [PATCH] loop bug fix --- src/components/ConcernementMapItem.vue | 64 +++++++++++++++----------- 1 file changed, 37 insertions(+), 27 deletions(-) diff --git a/src/components/ConcernementMapItem.vue b/src/components/ConcernementMapItem.vue index c080fb0..5240665 100644 --- a/src/components/ConcernementMapItem.vue +++ b/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) {