highlighting entite on opened superposed mapitem

This commit is contained in:
Bachir Soussi Chiadmi 2023-09-20 16:02:48 +02:00
parent c67afa76e3
commit db51224556

View File

@ -16,6 +16,7 @@ import Tween from "@tweenjs/tween.js";
import { mapState, mapActions } from 'pinia' import { mapState, mapActions } from 'pinia'
import { ConcernementsStore } from '@/stores/concernements' import { ConcernementsStore } from '@/stores/concernements'
import { CommonStore } from '@/stores/common' import { CommonStore } from '@/stores/common'
import { mdiPictureInPictureBottomRight } from '@mdi/js';
export default { export default {
inject: ['canvasMap', 'matterEngine'], inject: ['canvasMap', 'matterEngine'],
@ -1193,10 +1194,32 @@ export default {
// superposition // superposition
if (this.concernement.has_superpositions) { if (this.concernement.has_superpositions) {
if (this.map_mode === "superposition") { if (this.map_mode === "superposition") {
if (!this.is_open) {
this.paper_main_object.children.entites_superposes.visible = true; // if not opened and has_superpositions draw the entites_superposes points
} else {
this.paper_main_object.children.entites_superposes.visible = true; this.paper_main_object.children.entites_superposes.visible = true;
// highlight of entite part of opened superposition
if (this.$route.query.superposition_id) {
let superposition_id = this.$route.query.superposition_id;
if(superposition_id){
let ids = superposition_id.match(/(\d+)_(\d+)__(\d+)_(\d+)/i)
let group = this.paper_main_object.children['entites_superposes'];
if(group){
group.children.forEach((item) => {
if ( (this.cid === parseInt(ids[1]) && item.item_id === parseInt(ids[2]))
|| (this.cid === parseInt(ids[3]) && item.item_id === parseInt(ids[4])) ) {
item.definition = this.paper_symbol_definitions.entite_hover;
if(!item.focused){
item.scale(2)
item.focused = true;
}
} else if(!this.is_hover) {
item.definition = this.paper_symbol_definitions.entite;
if (item.focused) {
item.scale(0.5)
item.focused = false;
}
}
})
}
}
} }
} else { } else {
this.paper_main_object.children.entites_superposes.visible = false; this.paper_main_object.children.entites_superposes.visible = false;
@ -1258,6 +1281,9 @@ export default {
} }
} }
}, },
onIsHover(){ onIsHover(){
// handle layer z-index // handle layer z-index
@ -1277,10 +1303,10 @@ export default {
for(let paper_item of entites_superposes.children) { for(let paper_item of entites_superposes.children) {
if (this.is_hover) { if (this.is_hover) {
paper_item.definition = this.paper_symbol_definitions.entite_hover; paper_item.definition = this.paper_symbol_definitions.entite_hover;
paper_item.scale(2) // paper_item.scale(2)
} else { } else {
paper_item.definition = this.paper_symbol_definitions.entite; paper_item.definition = this.paper_symbol_definitions.entite;
paper_item.scale(0.5) // paper_item.scale(0.5)
} }
} }
} }