mouse over mapPopUp on besoin & reponse

This commit is contained in:
2023-05-22 18:15:04 +02:00
parent 8806507ecb
commit 302252a1c1
3 changed files with 79 additions and 50 deletions

View File

@@ -588,52 +588,6 @@ export default {
this.ctx.stroke();
},
drawEntites(){
// IF OPENED
if (this.opened) {
// place all entities points
// OR using entitées matter bodies
for (let i = 0; i < this.body.parts.length; i++) {
if (this.body.parts[i].item_type === 'entite'
// draw only entite agissante if map mode is action
&& ((this.map_mode === 'action' && this.body.parts[i].agissante) || this.map_mode !== "action")) {
let part = this.body.parts[i];
this.ctx.beginPath();
this.ctx.arc(part.position.x, part.position.y, 0.3*this.scale, 0, 2 * Math.PI, false);
// console.log(part.id, this.opened_entite_id);
if (part.id === this.opened_entite_id) {
this.ctx.fillStyle = "#F00";
} else {
this.ctx.fillStyle = "#000";
}
this.ctx.fill();
}
}
}
// IF CLOSED
else {
// map mode action
// if not opened and has_agissantes draw only entites agissantes
if (this.concernement.has_agissantes && this.map_mode === "action") {
for (let i = 0; i < this.body.parts.length; i++) {
if (this.body.parts[i].item_type === 'entite' && this.body.parts[i].agissante) {
let part = this.body.parts[i];
this.ctx.beginPath();
this.ctx.arc(part.position.x, part.position.y, 1*this.scale, 0, 2 * Math.PI, false);
// console.log(part.id, this.opened_entite_id);
if (part.id === this.opened_entite_id) {
this.ctx.fillStyle = "#F00";
} else {
this.ctx.fillStyle = "#000";
}
this.ctx.fill();
}
}
}
}
},
drawBesoins(){
for (let i = 0; i < this.body.parts.length; i++) {
if (this.body.parts[i].item_type === 'besoin' || this.body.parts[i].item_type === 'reponse') {
@@ -722,6 +676,52 @@ export default {
this.ctx.stroke();
},
drawEntites(){
// IF OPENED
if (this.opened) {
// place all entities points
// OR using entitées matter bodies
for (let i = 0; i < this.body.parts.length; i++) {
if (this.body.parts[i].item_type === 'entite'
// draw only entite agissante if map mode is action
&& ((this.map_mode === 'action' && this.body.parts[i].agissante) || this.map_mode !== "action")) {
let part = this.body.parts[i];
this.ctx.beginPath();
this.ctx.arc(part.position.x, part.position.y, 0.3*this.scale, 0, 2 * Math.PI, false);
// console.log(part.id, this.opened_entite_id);
if (part.id === this.opened_entite_id) {
this.ctx.fillStyle = "#F00";
} else {
this.ctx.fillStyle = "#000";
}
this.ctx.fill();
}
}
}
// IF CLOSED
else {
// map mode action
// if not opened and has_agissantes draw only entites agissantes
if (this.concernement.has_agissantes && this.map_mode === "action") {
for (let i = 0; i < this.body.parts.length; i++) {
if (this.body.parts[i].item_type === 'entite' && this.body.parts[i].agissante) {
let part = this.body.parts[i];
this.ctx.beginPath();
this.ctx.arc(part.position.x, part.position.y, 1*this.scale, 0, 2 * Math.PI, false);
// console.log(part.id, this.opened_entite_id);
if (part.id === this.opened_entite_id) {
this.ctx.fillStyle = "#F00";
} else {
this.ctx.fillStyle = "#000";
}
this.ctx.fill();
}
}
}
}
},
drawContour(){
if (this.salientPoints.length > 3) {
var fillStyle;