concernement's entitées are now matter body parts AND mouseoverable & clickable

This commit is contained in:
2023-04-18 21:55:44 +02:00
parent a2ae70ef48
commit 440e6d9f15
4 changed files with 73 additions and 45 deletions

View File

@@ -105,7 +105,7 @@ export default {
this.animate()
},
methods: {
...mapActions(ConcernementsStore,['openCloseConcernement']),
...mapActions(ConcernementsStore,['openCloseConcernements']),
...mapActions(ConcernementsStore,['resetConcernementOpened']),
animate () {
this.canvasMap.ctx.clearRect(0, 0, this.canvasMap.canvas.width, this.canvasMap.canvas.height)
@@ -115,7 +115,6 @@ export default {
},
onMouseMove (e) {
// check concernement item mouse over
// const query = Matter.Query.point(Matter.Composite.allBodies(this.world), this.mouse.position)
let query;
if (this.opened) {
// if a concernement is opened we query the opened concernement's parts (aka entitées bodies)
@@ -168,9 +167,8 @@ export default {
clickedIDs.push(elmt.id);
});
// open/close all concernements
this.concernements.forEach((concernement, index) => {
this.openCloseConcernement(concernement.id, clickedIDs.indexOf(concernement.id) !== -1)
});
this.openCloseConcernements(clickedIDs)
// if no concernement opened retrun to home (closing concernement contents opened)
// and reset the opened state in concernement store
if (!clickedIDs.length) {