superposition highlight on mouse hover

This commit is contained in:
2023-09-12 14:58:55 +02:00
parent 5836d39a38
commit 119ae3f242
4 changed files with 41 additions and 6 deletions

View File

@@ -186,6 +186,12 @@ export default {
},
deep: true
},
is_hover: {
handler (n, o) {
this.onIsHover(n);
},
deep: true
},
active_revision: {
handler (n, o) {
console.log(`concernementMapItem watch active_revision o:${o}, n:${n}`);
@@ -1250,6 +1256,26 @@ export default {
}
},
onIsHover(){
// handle layer z-index
if (this.is_hover) {
this.paper_main_object.bringToFront();
} else {
this.paper_main_object.sendToBack();
}
// hightlight superposed entites on focus
let entites_superposes = this.paper_main_object.children['entites_superposes'];
// console.log('entites_superposes.children', entites_superposes.children);
for(let paper_item of entites_superposes.children) {
if (this.is_hover) {
paper_item.definition = this.paper_symbol_definitions.entite_hover;
paper_item.scale(2)
} else {
paper_item.definition = this.paper_symbol_definitions.entite;
paper_item.scale(0.5)
}
}
},
// PAPER EVENTS
initPaperEvents(){
@@ -1938,11 +1964,10 @@ export default {
if (this.is_hover) { // if mouse hover reset the matter body position to prev position
Matter.Body.setPosition(this.body, {x:this.pos.x, y:this.pos.y}, true);
}else{ // else move following the matter body position
this.paper_main_object.position = this.pos = this.body.position;
}
this.paper_main_object.position = this.pos = this.body.position;
this.handlePaperVisibilityOnAfterEnginUpdate()
},