Skip to content

Commit b3d42d5

Browse files
committed
asymmetry: fix backward travel time displays
Adapted trainrun-section-tab and perlenkette for bottomTravelTime, and made backwardTravelTime displayed only if different of travelTime. Signed-off-by: Louis Greiner <[email protected]>
1 parent ec223a0 commit b3d42d5

File tree

5 files changed

+26
-15
lines changed

5 files changed

+26
-15
lines changed

src/app/perlenkette/perlenkette-section/perlenkette-section.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,9 @@ export class PerlenketteSectionComponent implements OnInit, AfterContentInit, On
505505
return true;
506506
}
507507
return (
508-
!this.trainrunSection.isSymmetric() && this.filterService.isFilterBackwardTravelTimeEnabled()
508+
this.trainrunSection.getTrainrun().isRoundTrip() &&
509+
!this.trainrunSection.isSymmetric() &&
510+
this.filterService.isFilterBackwardTravelTimeEnabled()
509511
);
510512
}
511513

src/app/view/dialogs/trainrun-and-section-dialog/trainrunsection-tab/trainrun-section-tab.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
*ngIf="TrainrunsectionHelper.isLeftSideDisplayed(selectedTrainrunSection)"
114114
></div>
115115
<div [ngClass]="getTravelTimeScssClass() + 'TravelTime'"></div>
116-
<div class="BottomTravelTime" *ngIf="!isSymmetric"></div>
116+
<div class="BottomTravelTime" *ngIf="isBottomTravelTimeDisplayed"></div>
117117

118118
<div
119119
class="focusguard"
@@ -387,7 +387,7 @@
387387
</button>
388388
</div>
389389

390-
<div class="BottomTravelTimeMinus" *ngIf="!isSymmetric">
390+
<div class="BottomTravelTimeMinus" *ngIf="isBottomTravelTimeDisplayed">
391391
<button
392392
tabindex="-1"
393393
mode="ghost"
@@ -397,7 +397,7 @@
397397
-
398398
</button>
399399
</div>
400-
<div class="BottomTravelTimeTime" *ngIf="!isSymmetric">
400+
<div class="BottomTravelTimeTime" *ngIf="isBottomTravelTimeDisplayed">
401401
<ng-container>
402402
<input
403403
tabindex="3"
@@ -420,7 +420,7 @@
420420
/>
421421
</ng-container>
422422
</div>
423-
<div class="BottomTravelTimePlus" *ngIf="!isSymmetric">
423+
<div class="BottomTravelTimePlus" *ngIf="isBottomTravelTimeDisplayed">
424424
<button
425425
tabindex="-1"
426426
mode="ghost"

src/app/view/dialogs/trainrun-and-section-dialog/trainrunsection-tab/trainrun-section-tab.component.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ export class TrainrunSectionTabComponent implements AfterViewInit, OnDestroy {
8282
public TrainrunsectionHelper = TrainrunsectionHelper;
8383
private destroyed = new Subject<void>();
8484

85-
public get isSymmetric(): boolean {
85+
public get isBottomTravelTimeDisplayed(): boolean {
86+
if (!this.selectedTrainrunSection.getTrainrun().isRoundTrip()) {
87+
return false;
88+
}
8689
const firstTrainrunSection = this.trainrunService.getFirstNonStopTrainrunSection(
8790
this.selectedTrainrunSection,
8891
);
@@ -93,10 +96,10 @@ export class TrainrunSectionTabComponent implements AfterViewInit, OnDestroy {
9396
while (iterator.hasNext()) {
9497
const nextPair = iterator.next();
9598
if (!nextPair.trainrunSection.isSymmetric()) {
96-
return false;
99+
return true;
97100
}
98101
}
99-
return true;
102+
return false;
100103
}
101104

102105
constructor(
@@ -326,13 +329,13 @@ export class TrainrunSectionTabComponent implements AfterViewInit, OnDestroy {
326329
}
327330

328331
getTravelTimeScssClass(): string {
329-
if (this.isSymmetric) {
330-
// If symmetric, travel time is displayed at the center
331-
return "";
332+
if (this.isBottomTravelTimeDisplayed) {
333+
// Travel time is displayed at the top
334+
// (and bottom travel time at the bottom)
335+
return "Top";
332336
}
333-
// If not symmetric, travel time is displayed at the top
334-
// (and bottom travel time at the bottom)
335-
return "Top";
337+
// Travel time is displayed at the center
338+
return "";
336339
}
337340

338341
onLeftNodeSymmetryToggleChanged(symmetry: boolean) {

src/app/view/editor-filter-view/editor-filter-view.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,10 @@ export class EditorFilterViewComponent implements OnInit, OnDestroy {
240240
filterTravelTimeChanged() {
241241
if (this.filterTravelTime) {
242242
this.filterService.enableFilterTravelTime();
243+
this.filterService.enableFilterBackwardTravelTime();
243244
} else {
244245
this.filterService.disableFilterTravelTime();
246+
this.filterService.disableFilterBackwardTravelTime();
245247
}
246248
}
247249

src/app/view/editor-main-view/data-views/trainrunsections.view.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,11 @@ export class TrainrunSectionsView {
945945
TrainrunSectionsView.isBothSideNonStop(trainrunSection)
946946
);
947947
case TrainrunSectionText.TrainrunSectionBackwardTravelTime:
948-
if (!trainrunSection.getTrainrun().isRoundTrip() || trainrunSection.isSymmetric()) {
948+
if (
949+
!this.editorView.isFilterBackwardTravelTimeEnabled() ||
950+
!trainrunSection.getTrainrun().isRoundTrip() ||
951+
trainrunSection.areTravelTimesEqual()
952+
) {
949953
return true;
950954
}
951955
if (this.editorView.isFilterShowNonStopTimeEnabled()) {

0 commit comments

Comments
 (0)