From a33104e402163b8615681bcf2103d1d2fa3b5d40 Mon Sep 17 00:00:00 2001 From: bach Date: Wed, 26 Feb 2025 16:48:30 +0100 Subject: [PATCH] cercle po: active steo is visualy focused --- src/components/ConcernementMapItem.vue | 48 +++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/components/ConcernementMapItem.vue b/src/components/ConcernementMapItem.vue index a3298e6..fbeb75f 100644 --- a/src/components/ConcernementMapItem.vue +++ b/src/components/ConcernementMapItem.vue @@ -395,6 +395,13 @@ export default { }, deep: true }, + 'concernement.opened_doleance': { + handler (n, o) { + console.log(`${this.id} watch concernement.opened_doleance o, n`, o, n); + this.focusOpenedDoleanceStep(); + }, + deep: true + }, wait: { handler (n, o){ // when we are reloading entites par exemple @@ -2209,8 +2216,9 @@ export default { } else if(!this.doleance_transition) { this.concernement.doleances.forEach((d) => { this.paper_main_object.children.doleances.children[`doleance_${d.id}`].visible = d.id === this.concernement.opened_doleance.id; - }) + }) } + } } else { // this.paper_main_object.children.doleance_icon.visible = false; @@ -2252,6 +2260,44 @@ export default { } + }, + focusOpenedDoleanceStep(){ + console.log('focusOpenedDoleanceStep', this.concernement.opened_doleance); + + if (this.concernement.has_doleance) { + if (this.map_mode === "doleancer") { + if (this.is_open) { + // focus on opened doleance step + if (this.concernement.opened_doleance.field) { + let paper_doleance = this.paper_main_object.children.doleances.children[`doleance_${this.concernement.opened_doleance.id}`]; + console.log('paper_doleance', paper_doleance); + paper_doleance.children.forEach((step) =>{ + // console.log('step.item_type', step.item_type); + let active = false; + if (step.field === this.concernement.opened_doleance.field) { + if(typeof this.concernement.opened_doleance.field_index != 'undefined'){ + // we have an index, let find if we have the right step here + if (this.concernement.opened_doleance.field_index === step.field_index) { + active = true; + } + }else{ + // we do not have a field index, so it is a single step, so it is active no matter the index + active = true + } + } + + if (active) { + // step.data.prevStrokeColor is for hover_elmt wtahc in MapConcernements.vue + step.data.prevStrokeColor = step.strokeColor = "#01ffe2"; + } else { + step.data.prevStrokeColor = step.strokeColor = "#fff"; + } + + }); + } + } + } + } }, initDoleanceTransition(from, to){ if (!this.doleance_transition) {