Commit 8a6923e4 authored by Romain DELEAU's avatar Romain DELEAU

move chronologie steps

parent 8f6e79aa
...@@ -23,6 +23,17 @@ export class Mission { ...@@ -23,6 +23,17 @@ export class Mission {
} }
} }
public moveStep(i: number, direction: string): void {
let tmp: Step|null = this.chronologie[i];
if (direction == 'left') {
this.chronologie[i] = this.chronologie[i-1];
this.chronologie[i-1] = tmp;
} else if (direction == 'right') {
this.chronologie[i] = this.chronologie[i+1];
this.chronologie[i+1] = tmp;
}
}
public calcMaxLineLength(): number { public calcMaxLineLength(): number {
let length: number = 0; let length: number = 0;
let cpt: number = 0; let cpt: number = 0;
......
...@@ -62,4 +62,15 @@ export class Role { ...@@ -62,4 +62,15 @@ export class Role {
this.tasks[i][j+1] = tmp; this.tasks[i][j+1] = tmp;
} }
} }
public moveStep(i: number, direction: string): void {
let tmp: Step|null = this.chronologie[i];
if (direction == 'left') {
this.chronologie[i] = this.chronologie[i-1];
this.chronologie[i-1] = tmp;
} else if (direction == 'right') {
this.chronologie[i] = this.chronologie[i+1];
this.chronologie[i+1] = tmp;
}
}
} }
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
<div class="piece-attach piece-attach-left"></div> <div class="piece-attach piece-attach-left"></div>
<div class="piece-menu" [class]="displayMenu"> <div class="piece-menu" [class]="displayMenu">
<mat-icon fontIcon="arrow_back_ios" (click)="moveStep('left')" *ngIf="index > 0"></mat-icon>
<mat-icon fontIcon="backspace" (click)="onClickErase()"></mat-icon> <mat-icon fontIcon="backspace" (click)="onClickErase()"></mat-icon>
<mat-icon fontIcon="delete" (click)="onClickDelete()"></mat-icon> <mat-icon fontIcon="delete" (click)="onClickDelete()"></mat-icon>
<mat-icon fontIcon="more_vert" (click)="onClickDots()"></mat-icon> <mat-icon fontIcon="more_vert" (click)="onClickDots()"></mat-icon>
<mat-icon fontIcon="arrow_forward_ios" (click)="moveStep('right')"></mat-icon>
</div> </div>
<div class="piece-form"> <div class="piece-form">
......
...@@ -43,6 +43,12 @@ export class StepComponent implements OnInit { ...@@ -43,6 +43,12 @@ export class StepComponent implements OnInit {
this.mission.equalizeLengths(); this.mission.equalizeLengths();
} }
moveStep(direction: string) {
this.parent.moveStep(this.index, direction);
this.displayMenu = 'hide';
this.mission.equalizeLengths();
}
durationChange(): void { durationChange(): void {
/* /*
if(this.step.durationUnit === 'UT') { if(this.step.durationUnit === 'UT') {
......
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