Hide/show la popin d'infos des sauts

This commit is contained in:
Sébastien André
2020-12-27 16:48:16 +01:00
parent 932fba5991
commit f59debf36a
3 changed files with 13 additions and 9 deletions

View File

@@ -28,11 +28,11 @@ table {
}
.stylePopin {
position: absolute;
right: 10px;
top: 0;
position: relative;
right: -25px;
top: -25px;
border: 1px solid black;
z-index: 1000;
/* z-index: 1000; */
}
.showPopin {
display: '';

View File

@@ -5,11 +5,13 @@
<th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let element" style="text-align: left; cursor: pointer;">
<mat-icon aria-hidden="false" aria-label="All informations of the jump"
(click)="showPopin($event, element)" style="display: block;">info</mat-icon>
<span [ngClass]="calculateClasses(element)">
(click)="showPopin($event, element)">info</mat-icon>
<div [ngClass]="calculateClasses(element)">
<span>
Gear : {{element.gear.mainCanopy}} ({{element.gear.mainCanopy}})
<br>Cutaway : {{element.withCutaway}}
<br>Notes : {{element.notes}}</span>
</div>
</td>
</ng-container>

View File

@@ -25,6 +25,7 @@ export class ListOfJumpsComponent implements OnInit {
public dataSourceTable;
public resultsLength = 0;
private previousElementId = -1;
private closePopin = false;
@ViewChild(MatPaginator, { static: true }) paginator: MatPaginator;
constructor(
@@ -56,15 +57,16 @@ export class ListOfJumpsComponent implements OnInit {
this.previousElementId = elementId;
}
if (elementId != this.previousElementId ) {
this.closePopin = (elementId === this.previousElementId);
if (elementId != this.previousElementId) {
this.previousElementId = elementId;
}
}
calculateClasses(item) {
return {
'showPopin': item.id === this.previousElementId,
'hidePopin': item.id != this.previousElementId,
'showPopin': !this.closePopin || item.id === this.previousElementId,
'hidePopin': this.closePopin || item.id != this.previousElementId,
'stylePopin': true
};
}