From a9e6fe25678cf6e15002cbf701a95f3a192f87c3 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 3 Jun 2025 13:01:02 +0200 Subject: [PATCH] fixed recording entity when switching or closing entity --- src/components/ConcernementMapItem.vue | 48 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/components/ConcernementMapItem.vue b/src/components/ConcernementMapItem.vue index b0537c3..da7e4ad 100644 --- a/src/components/ConcernementMapItem.vue +++ b/src/components/ConcernementMapItem.vue @@ -87,7 +87,8 @@ export default { 'detailsZoomValue', 'reloadConcernements', 'reloadConcernementEntites', - 'concernements_loading_nb']), + 'concernements_loading_nb', + 'concernement_is_updating_nid']), ...mapState(CommonStore,['hover_elmt', 'map_item_ray', 'cartouch_width', @@ -2630,15 +2631,23 @@ export default { case "superposition": case "action": // we have clicked on an entite - this.$router.push({ - name: 'concernement', - params: {cid: this.cid, eid: result.item.item_id}, - query: { - mapitemid: this.id, - // superposition_id: this.mapitem.superposition_ids[0] - }, - hash: `#${this.map_mode}`, - }); + // unfocus any active element to trigger recording if needed + document.activeElement.blur(); + // setInterval to let time for editable fields to focus out and record changes + let interval = setInterval(() => { + if (!this.concernement_is_updating_nid) { + clearInterval(interval); + this.$router.push({ + name: 'concernement', + params: {cid: this.cid, eid: result.item.item_id}, + query: { + mapitemid: this.id, + // superposition_id: this.mapitem.superposition_ids[0] + }, + hash: `#${this.map_mode}`, + }); + } + }, 1) break; case "proximite": switch (result.item.item_type) { @@ -2669,11 +2678,20 @@ export default { } else { // otherwise we close the entite and come back to the concernement - this.$router.push({ - name: 'concernement', - hash: `#${this.map_mode}`, - params: {id: this.cid, mapitemid: this.id} - }); + // unfocus any active element to trigger recording if needed + document.activeElement.blur(); + // setInterval to let time for editable fields to focus out and record changes + let interval = setInterval(() => { + if (!this.concernement_is_updating_nid) { + clearInterval(interval); + this.$router.push({ + name: 'concernement', + hash: `#${this.map_mode}`, + params: {id: this.cid, mapitemid: this.id} + }); + } + }, 1) + // reset the mousehover this.resetHoverElmt();