|
@@ -520,13 +520,17 @@ export default {
|
|
|
// record the position from the main matter body
|
|
|
this.pos = this.body.position;
|
|
|
|
|
|
+ // drawing backgrounds
|
|
|
if (this.opened) {
|
|
|
switch (this.map_mode) {
|
|
|
case 'terraindevie':
|
|
|
- this.drawBoussole();
|
|
|
+ this.drawBoussoleBG();
|
|
|
break;
|
|
|
case 'puissancedagir':
|
|
|
- this.drawPuissanceagir();
|
|
|
+ this.drawPuissanceagirBG();
|
|
|
+ break;
|
|
|
+ case 'doleancer':
|
|
|
+ this.drawDoleancerBG();
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -538,12 +542,21 @@ export default {
|
|
|
}
|
|
|
|
|
|
// map mode puissance d'agir
|
|
|
- // if not opened and has_puissancedagir draw the puissance d'agir icone
|
|
|
if (this.concernement.has_puissancedagir && this.map_mode === "puissancedagir") {
|
|
|
if (!this.opened) {
|
|
|
- this.drawPuissanceagirIcon();
|
|
|
+ this.drawPuissanceagirIcon(); // if not opened and has_puissancedagir draw the puissance d'agir icone
|
|
|
} else {
|
|
|
- this.drawBesoins()
|
|
|
+ this.drawBesoins();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // map mode doleancer
|
|
|
+ // if not opened and has_doleance draw the doleance icone
|
|
|
+ if (this.concernement.has_doleance && this.map_mode === "doleancer") {
|
|
|
+ if (!this.opened) {
|
|
|
+ this.drawDoleanceIcon(); // if not opened and has_puissancedagir draw the puissance d'agir icone
|
|
|
+ } else {
|
|
|
+ this.drawDoleanceSteps();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -553,7 +566,7 @@ export default {
|
|
|
|
|
|
|
|
|
},
|
|
|
- drawPuissanceagir(){
|
|
|
+ drawPuissanceagirBG(){
|
|
|
|
|
|
for (let i = 1; i < 6; i++) {
|
|
|
this.ctx.beginPath();
|
|
@@ -688,7 +701,74 @@ export default {
|
|
|
this.ctx.lineTo(x - r, y);
|
|
|
this.ctx.lineTo(x, y - r);
|
|
|
},
|
|
|
- drawBoussole(){
|
|
|
+ drawDoleanceIcon(){
|
|
|
+ var r = 20 * this.scale; // ray
|
|
|
+ var dr = r/2; // demi ray
|
|
|
+ var d = r*2; // diameter
|
|
|
+
|
|
|
+ this.ctx.beginPath();
|
|
|
+ this.ctx.lineWidth = 1;
|
|
|
+ this.ctx.strokeStyle = `#000`;
|
|
|
+ this.ctx.arc(this.pos.x, this.pos.y, r, 0, 2 * Math.PI, false);
|
|
|
+ this.ctx.stroke();
|
|
|
+
|
|
|
+ this.ctx.beginPath();
|
|
|
+ this.ctx.lineWidth = 1;
|
|
|
+ this.ctx.strokeStyle = `#000`;
|
|
|
+ this.ctx.arc(this.pos.x, this.pos.y, dr, 0, 2 * Math.PI, false);
|
|
|
+ this.ctx.stroke();
|
|
|
+
|
|
|
+
|
|
|
+ // axes
|
|
|
+ this.ctx.beginPath();
|
|
|
+ this.ctx.lineWidth = 1;
|
|
|
+ this.ctx.strokeStyle = `#000`;
|
|
|
+ // vertical
|
|
|
+ this.ctx.moveTo(this.pos.x, this.pos.y - r);
|
|
|
+ this.ctx.lineTo(this.pos.x , this.pos.y - dr);
|
|
|
+ this.ctx.moveTo(this.pos.x, this.pos.y + r);
|
|
|
+ this.ctx.lineTo(this.pos.x , this.pos.y + dr);
|
|
|
+ // this.ctx.moveTo(this.pos.x, this.pos.y - r);
|
|
|
+ // this.ctx.lineTo(this.pos.x , this.pos.y + r);
|
|
|
+
|
|
|
+ // horizontal
|
|
|
+ this.ctx.moveTo(this.pos.x - r, this.pos.y);
|
|
|
+ this.ctx.lineTo(this.pos.x - dr, this.pos.y);
|
|
|
+ this.ctx.moveTo(this.pos.x + r, this.pos.y);
|
|
|
+ this.ctx.lineTo(this.pos.x + dr, this.pos.y);
|
|
|
+ // this.ctx.moveTo(this.pos.x - r, this.pos.y);
|
|
|
+ // this.ctx.lineTo(this.pos.x + r, this.pos.y);
|
|
|
+
|
|
|
+ // diagonale
|
|
|
+ // https://fr.wikipedia.org/wiki/Trigonom%C3%A9trie#/media/Fichier:Unit_circle_angles_color.svg
|
|
|
+ // https://fr.wikipedia.org/wiki/Identit%C3%A9_trigonom%C3%A9trique_pythagoricienne#Preuve_utilisant_le_cercle_unit%C3%A9
|
|
|
+ // radians = degrees * (pi/180)
|
|
|
+ // degrees = radians * (180/pi)
|
|
|
+ let m,n;
|
|
|
+ m = Math.sin(45*(Math.PI/180)) * r;
|
|
|
+ n = Math.sin(45*(Math.PI/180)) * r/2;
|
|
|
+ // console.log('m', m);
|
|
|
+ this.ctx.moveTo(this.pos.x + m, this.pos.y + m);
|
|
|
+ this.ctx.lineTo(this.pos.x + n, this.pos.y + n);
|
|
|
+ //
|
|
|
+ this.ctx.moveTo(this.pos.x - m, this.pos.y + m);
|
|
|
+ this.ctx.lineTo(this.pos.x - n, this.pos.y + n);
|
|
|
+ //
|
|
|
+ this.ctx.moveTo(this.pos.x + m, this.pos.y - m);
|
|
|
+ this.ctx.lineTo(this.pos.x + n, this.pos.y - n);
|
|
|
+ //
|
|
|
+ this.ctx.moveTo(this.pos.x - m, this.pos.y - m);
|
|
|
+ this.ctx.lineTo(this.pos.x - n, this.pos.y - n);
|
|
|
+
|
|
|
+ this.ctx.stroke();
|
|
|
+ },
|
|
|
+ drawDoleancerBG(){
|
|
|
+
|
|
|
+ },
|
|
|
+ drawDoleanceSteps(){
|
|
|
+
|
|
|
+ },
|
|
|
+ drawBoussoleBG(){
|
|
|
// BOUSSOLE
|
|
|
// exterieur circle
|
|
|
this.ctx.beginPath();
|
|
@@ -850,7 +930,8 @@ export default {
|
|
|
isFocused(){
|
|
|
return this.map_mode === 'terraindevie'
|
|
|
|| (this.map_mode === 'action' && this.concernement.has_agissantes)
|
|
|
- || (this.map_mode === 'puissancedagir' && this.concernement.has_puissancedagir);
|
|
|
+ || (this.map_mode === 'puissancedagir' && this.concernement.has_puissancedagir)
|
|
|
+ || (this.map_mode === 'doleancer' && this.concernement.has_doleance);
|
|
|
}
|
|
|
},
|
|
|
render() {
|