Commit 792ffc99 authored by Romain DELEAU's avatar Romain DELEAU

switch line tasks

parent 2694f558
......@@ -58,10 +58,22 @@ export class Role {
if (direction == 'left') {
this.tasks[i][j] = this.tasks[i][j-1];
this.tasks[i][j-1] = tmp;
} else if (direction == 'right' && (this.tasks[i][j+1]?.type != 'final' && this.tasks[i][j+1]?.type != 'repeat')) {
} else if (direction == 'right') {
this.tasks[i][j] = this.tasks[i][j+1];
this.tasks[i][j+1] = tmp;
}
} else if (direction == 'top') {
this.tasks[i][j] = this.tasks[i-1][j];
this.tasks[i-1][j] = tmp;
if (!this.tasks[i].some(element => element instanceof Task)) {
this.tasks.splice(i,1);
}
} else if (direction == 'bottom') {
if (this.tasks[i+2] == null) {
this.tasks[i+2] = [];
}
this.tasks[i][j] = this.tasks[i+1][j];
this.tasks[i+1][j] = tmp;
}
}
public moveStep(i: number, direction: string): void {
......
......@@ -11,6 +11,9 @@
<mat-icon fontIcon="arrow_back_ios" (click)="moveTask('left')" *ngIf="canMoveTo('left')"
matTooltip="Décaler la tuile vers la gauche."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_less" (click)="moveTask('top')" *ngIf="canMoveTo('top')"
matTooltip="Décaler la tuile vers le haut."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<div>
<mat-icon fontIcon="change_circle" [matMenuTriggerFor]="menuChange"
matTooltip="Changer le type de cette tuile."
......@@ -27,6 +30,9 @@
<mat-icon fontIcon="delete" (click)="onClickDelete()"
matTooltip="Supprimer la tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_more" (click)="moveTask('bottom')" *ngIf="canMoveTo('bottom')"
matTooltip="Décaler la tuile vers le bas."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="arrow_forward_ios" (click)="moveTask('right')" *ngIf="canMoveTo('right')"
matTooltip="Décaler la tuile vers la droite."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
......
......@@ -148,6 +148,20 @@ export class AnnexeTaskComponent implements OnInit {
if (this.role.tasks[this.i][this.j+1]?.type == 'final' || this.role.tasks[this.i][this.j+1]?.type == 'repeat') {
res = false;
}
} else if (direction == 'top') {
if (this.i == 0) {
res = false;
} else if (this.role.tasks[this.i-1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i-1][this.j]?.type == 'final' || this.role.tasks[this.i-1][this.j]?.type == 'repeat')) {
res = false;
}
} else if (direction == 'bottom') {
if (this.role.tasks[this.i+1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i+1][this.j]?.type == 'final' || this.role.tasks[this.i+1][this.j]?.type == 'repeat')) {
res = false;
}
}
return res;
}
......
......@@ -10,6 +10,9 @@
<mat-icon fontIcon="arrow_back_ios" (click)="moveTask('left')" *ngIf="canMoveTo('left')"
matTooltip="Décaler la tuile vers la gauche."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_less" (click)="moveTask('top')" *ngIf="canMoveTo('top')"
matTooltip="Décaler la tuile vers le haut."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<div>
<mat-icon fontIcon="change_circle" [matMenuTriggerFor]="menuChange"
matTooltip="Changer le type de cette tuile."
......@@ -26,6 +29,9 @@
<mat-icon fontIcon="delete" (click)="onClickDelete()"
matTooltip="Supprimer la tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_more" (click)="moveTask('bottom')" *ngIf="canMoveTo('bottom')"
matTooltip="Décaler la tuile vers le bas."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="arrow_forward_ios" (click)="moveTask('right')" *ngIf="canMoveTo('right')"
matTooltip="Décaler la tuile vers la droite."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
......
......@@ -150,6 +150,22 @@ export class FinalTaskComponent implements OnInit {
if (this.role.tasks[this.i][this.j-1] instanceof Task || this.j == 0) {
res = false;
}
} else if (direction == 'top') {
if (this.i == 0) {
res = false;
} else if (this.role.tasks[this.i - 1].some(element => element?.type == 'final' || element?.type == 'repeat')) {
let index: number = this.role.tasks[this.i - 1].findIndex(element => element?.type == 'final' || element?.type == 'repeat');
if (index != this.j) {
res = false;
}
}
} else if (direction == 'bottom') {
if (this.role.tasks[this.i + 1].some(element => element?.type == 'final' || element?.type == 'repeat')) {
let index: number = this.role.tasks[this.i + 1].findIndex(element => element?.type == 'final' || element?.type == 'repeat');
if (index != this.j) {
res = false;
}
}
}
return res;
}
......
......@@ -11,6 +11,9 @@
<mat-icon fontIcon="arrow_back_ios" (click)="moveTask('left')" *ngIf="canMoveTo('left')"
matTooltip="Décaler la tuile vers la gauche."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_less" (click)="moveTask('top')" *ngIf="canMoveTo('top')"
matTooltip="Décaler la tuile vers le haut."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<div>
<mat-icon fontIcon="change_circle" [matMenuTriggerFor]="menuChange"
matTooltip="Changer le type de cette tuile."
......@@ -27,6 +30,9 @@
<mat-icon fontIcon="delete" (click)="onClickDelete()"
matTooltip="Supprimer la tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_more" (click)="moveTask('bottom')" *ngIf="canMoveTo('bottom')"
matTooltip="Décaler la tuile vers le bas."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="arrow_forward_ios" (click)="moveTask('right')" *ngIf="canMoveTo('right')"
matTooltip="Décaler la tuile vers la droite."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
......
......@@ -157,7 +157,6 @@ export class OptionnalTaskComponent implements OnInit {
this.displaySymbolChoice = 'hide';
this.mission.equalizeLengths();
}
canMoveTo(direction: string): boolean {
let res: boolean = true;
if (direction == 'left') {
......@@ -168,6 +167,20 @@ export class OptionnalTaskComponent implements OnInit {
if (this.role.tasks[this.i][this.j+1]?.type == 'final' || this.role.tasks[this.i][this.j+1]?.type == 'repeat') {
res = false;
}
} else if (direction == 'top') {
if (this.i == 0) {
res = false;
} else if (this.role.tasks[this.i-1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i-1][this.j]?.type == 'final' || this.role.tasks[this.i-1][this.j]?.type == 'repeat')) {
res = false;
}
} else if (direction == 'bottom') {
if (this.role.tasks[this.i+1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i+1][this.j]?.type == 'final' || this.role.tasks[this.i+1][this.j]?.type == 'repeat')) {
res = false;
}
}
return res;
}
......
......@@ -9,12 +9,18 @@
<mat-icon fontIcon="arrow_back_ios" (click)="moveTask('left')" *ngIf="canMoveTo('left')"
matTooltip="Décaler la tuile vers la gauche."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_less" (click)="moveTask('top')" *ngIf="canMoveTo('top')"
matTooltip="Décaler la tuile vers le haut."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="backspace" (click)="onClickErase()"
matTooltip="Effacer le contenu de cette tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="delete" (click)="onClickDelete()"
matTooltip="Supprimer la tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_more" (click)="moveTask('bottom')" *ngIf="canMoveTo('bottom')"
matTooltip="Décaler la tuile vers le bas."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="arrow_forward_ios" (click)="moveTask('right')" *ngIf="canMoveTo('right')"
matTooltip="Décaler la tuile vers la droite."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
......
......@@ -145,6 +145,20 @@ export class RandomEventComponent implements OnInit {
if (this.role.tasks[this.i][this.j+1]?.type == 'final' || this.role.tasks[this.i][this.j+1]?.type == 'repeat') {
res = false;
}
} else if (direction == 'top') {
if (this.i == 0) {
res = false;
} else if (this.role.tasks[this.i-1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i-1][this.j]?.type == 'final' || this.role.tasks[this.i-1][this.j]?.type == 'repeat')) {
res = false;
}
} else if (direction == 'bottom') {
if (this.role.tasks[this.i+1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i+1][this.j]?.type == 'final' || this.role.tasks[this.i+1][this.j]?.type == 'repeat')) {
res = false;
}
}
return res;
}
......
......@@ -5,12 +5,18 @@
<mat-icon fontIcon="arrow_back_ios" (click)="moveTask('left')" *ngIf="canMoveTo('left')"
matTooltip="Décaler la tuile vers la gauche."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_less" (click)="moveTask('top')" *ngIf="canMoveTo('top')"
matTooltip="Décaler la tuile vers le haut."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="backspace" (click)="onClickErase()"
matTooltip="Effacer le contenu de cette tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="delete" (click)="onClickDelete()"
matTooltip="Supprimer la tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_more" (click)="moveTask('bottom')" *ngIf="canMoveTo('bottom')"
matTooltip="Décaler la tuile vers le bas."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="arrow_forward_ios" (click)="moveTask('right')" *ngIf="canMoveTo('right')"
matTooltip="Décaler la tuile vers la droite."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
......
......@@ -76,6 +76,22 @@ export class RepeatTaskComponent implements OnInit {
if (this.role.tasks[this.i][this.j-1] instanceof Task || this.j == 0) {
res = false;
}
} else if (direction == 'top') {
if (this.i == 0) {
res = false;
} else if (this.role.tasks[this.i - 1].some(element => element?.type == 'final' || element?.type == 'repeat')) {
let index: number = this.role.tasks[this.i - 1].findIndex(element => element?.type == 'final' || element?.type == 'repeat');
if (index != this.j) {
res = false;
}
}
} else if (direction == 'bottom') {
if (this.role.tasks[this.i + 1].some(element => element?.type == 'final' || element?.type == 'repeat')) {
let index: number = this.role.tasks[this.i + 1].findIndex(element => element?.type == 'final' || element?.type == 'repeat');
if (index != this.j) {
res = false;
}
}
}
return res;
}
......
......@@ -9,6 +9,9 @@
<mat-icon fontIcon="arrow_back_ios" (click)="moveTask('left')" *ngIf="canMoveTo('left')"
matTooltip="Décaler la tuile vers la gauche."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_less" (click)="moveTask('top')" *ngIf="canMoveTo('top')"
matTooltip="Décaler la tuile vers le haut."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<div>
<mat-icon fontIcon="change_circle" [matMenuTriggerFor]="menuChange"
matTooltip="Changer le type de cette tuile."
......@@ -25,6 +28,9 @@
<mat-icon fontIcon="delete" (click)="onClickDelete()"
matTooltip="Supprimer la tuile."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="expand_more" (click)="moveTask('bottom')" *ngIf="canMoveTo('bottom')"
matTooltip="Décaler la tuile vers le bas."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
<mat-icon fontIcon="arrow_forward_ios" (click)="moveTask('right')" *ngIf="canMoveTo('right')"
matTooltip="Décaler la tuile vers la droite."
matTooltipPosition="above" [matTooltipDisabled]="!tooltipService.activatedTooltips"></mat-icon>
......
......@@ -168,6 +168,20 @@ export class TaskComponent implements OnInit {
if (this.role.tasks[this.i][this.j+1]?.type == 'final' || this.role.tasks[this.i][this.j+1]?.type == 'repeat') {
res = false;
}
} else if (direction == 'top') {
if (this.i == 0) {
res = false;
} else if (this.role.tasks[this.i-1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i-1][this.j]?.type == 'final' || this.role.tasks[this.i-1][this.j]?.type == 'repeat')) {
res = false;
}
} else if (direction == 'bottom') {
if (this.role.tasks[this.i+1].slice(0, this.j).some(element => element?.type == 'final' || element?.type == 'repeat')) {
res = false;
} else if (this.role.tasks[this.i].some(element => element?.type == 'final' || element?.type == 'repeat') && (this.role.tasks[this.i+1][this.j]?.type == 'final' || this.role.tasks[this.i+1][this.j]?.type == 'repeat')) {
res = false;
}
}
return res;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment