Skip to content

Commit 2f5d187

Browse files
Fix affichage gradins
1 parent 858021c commit 2f5d187

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

src/app/components/map/input/game-status.manager.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Konva from 'konva';
22
import {TABLE} from '../../../constants/constants';
33
import {GameStatus, GradinBrut, GradinBrutId, Team,} from '../../../models/showMustGoOn/GameStatus';
4-
import {start} from "@popperjs/core";
54

65
export class GameStatusManager {
76
gradinsBruts: Konva.Group;
@@ -32,8 +31,8 @@ export class GameStatusManager {
3231

3332
this.addAireConstruction(status.airesConstruction?.petitEquipe, team === Team.JAUNE ? 550 : 2000)
3433
this.addAireConstruction(status.airesConstruction?.grandEquipe, team === Team.JAUNE ? 1000 : 1550)
35-
this.addAireConstruction(status.airesConstruction?.petitAdverse, team === Team.JAUNE ? 2000 : 550)
36-
this.addAireConstruction(status.airesConstruction?.grandAdverse, team === Team.JAUNE ? 1550 : 1000)
34+
this.addAireConstruction(status.airesConstruction?.petitAdverse, team === Team.JAUNE ? 2550 : 0)
35+
this.addAireConstruction(status.airesConstruction?.grandAdverse, team === Team.JAUNE ? 3000 : 450, true, team === Team.BLEU)
3736
}
3837

3938
private addGradinBrut(gradinBrut: GradinBrut) {
@@ -64,14 +63,14 @@ export class GameStatusManager {
6463
planche.moveToBottom()
6564

6665
const plancheText = new Konva.Text({
67-
text: gradinBrut.id.split('_').slice(1, 3).join(' '),
66+
text: gradinBrut.id.replaceAll('_', ' '),
6867
x: 0,
6968
y: 0,
7069
width: 400,
7170
height: 100,
7271
align: 'center',
7372
verticalAlign: 'middle',
74-
fontSize: 40,
73+
fontSize: 35,
7574
fontStyle: 'bold',
7675
fill: 'black',
7776
stroke: 'white',
@@ -84,20 +83,27 @@ export class GameStatusManager {
8483
this.gradinsBruts.add(plancheGroup)
8584
}
8685

87-
private addAireConstruction(aireConstruction: boolean[][], startX: number) {
88-
aireConstruction.forEach((gradinConstruit, index) => this.addGradinConstruit(gradinConstruit, startX, index))
86+
private addAireConstruction(aireConstruction: boolean[][], startX: number, vertical = false, reversed = false) {
87+
if (reversed) {
88+
aireConstruction.slice().reverse().forEach((gradinConstruit, index) =>
89+
this.addGradinConstruit(gradinConstruit, startX, index, vertical))
90+
} else {
91+
aireConstruction.forEach((gradinConstruit, index) =>
92+
this.addGradinConstruit(gradinConstruit, startX, index, vertical))
93+
}
8994
}
9095

91-
private addGradinConstruit(gradinConstruit: boolean[], startX: number, index: number) {
96+
private addGradinConstruit(gradinConstruit: boolean[], startX: number, index: number, vertical: boolean) {
9297
if (!gradinConstruit[0]) return;
9398

9499
const gradinGroup = new Konva.Group({
95-
x: (startX + 25) * TABLE.imageRatio,
96-
y: (TABLE.height - 150 - index * 125) * TABLE.imageRatio,
100+
x: (vertical ? startX - 150 - index * 125 : (startX + 25)) * TABLE.imageRatio,
101+
y: (vertical ? (TABLE.height - 675) : TABLE.height - 150 - index * 125) * TABLE.imageRatio,
97102
width: 400,
98103
height: 100,
99104
scaleX: TABLE.imageRatio,
100105
scaleY: TABLE.imageRatio,
106+
rotation: vertical ? -90 : 0,
101107
})
102108

103109
const gradin = new Konva.Rect({

src/app/services/mock/mouvements.mock-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class MouvementsMockService extends MouvementsService {
9696
[ true, false, false ],
9797
],
9898
grandAdverse: [
99-
[ false, false, false ],
99+
[ true, true, true ],
100100
[ true, false, false ],
101101
[ true, true, false ],
102102
]

0 commit comments

Comments
 (0)