Skip to content

Commit ef671ff

Browse files
Fix: One way train run arrows are drawn outside of lines when moving node (#591)
* Fix: When dragging a node, the train route section is displayed very abstractly—just as a line. As soon as the node is dragged, the full detail display is applied. This ensures high drag performance and prevents elements that have not yet been fully updated (recalculated) from being displayed incorrectly. This means that not everything always needs to be fully updated when dragging, which further improves performance. * Fix: Add filter to groupLinesEnter: render arrows only for non-round trips * fix: npm run format * Update src/app/view/editor-main-view/data-views/trainrunsections.view.ts Perfect! Really nice spot. Thanks a lot Co-authored-by: Louis Greiner <57864277+louisgreiner@users.noreply.github.com> * fix commit (suggested) - it had wrong }) --------- Co-authored-by: Louis Greiner <57864277+louisgreiner@users.noreply.github.com>
1 parent 9acf684 commit ef671ff

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,10 +1055,9 @@ export class TrainrunSectionsView {
10551055
) {
10561056
(["BEGINNING_ARROW", "ENDING_ARROW"] as const).forEach((arrowType) => {
10571057
groupLinesEnter
1058+
.filter((d: TrainrunSectionViewObject) => !d.trainrunSection.getTrainrun().isRoundTrip())
10581059
.append(StaticDomTags.EDGE_LINE_ARROW_SVG)
1059-
.attr("d", (d: TrainrunSectionViewObject) => {
1060-
return d.trainrunSection.getTrainrun().isRoundTrip() ? "" : "M-4,-5L2,0L-4,5Z";
1061-
})
1060+
.attr("d", "M-4,-5L2,0L-4,5Z")
10621061
.attr("transform", (d: TrainrunSectionViewObject) =>
10631062
this.translateAndRotateArrow(d.trainrunSection, arrowType),
10641063
)
@@ -2178,6 +2177,8 @@ export class TrainrunSectionsView {
21782177
);
21792178

21802179
if (!this.editorView.isElementDragging()) {
2180+
this.createDirectionArrows(groupLines, selectedTrainrun, connectedTrainIds, false);
2181+
21812182
const groupLabels = inGroupLabels.filter(
21822183
(d: TrainrunSectionViewObject) =>
21832184
!this.filterOutAllTrainrunSectionWithHiddenNodeConnection(d.trainrunSection),
@@ -2299,6 +2300,8 @@ export class TrainrunSectionsView {
22992300
);
23002301

23012302
if (!this.editorView.isElementDragging()) {
2303+
this.createDirectionArrows(groupLines, selectedTrainrun, connectedTrainIds, true);
2304+
23022305
const groupLabels = inGroupLabels.filter((d: TrainrunSectionViewObject) =>
23032306
this.filterOutAllTrainrunSectionWithHiddenNodeConnection(d.trainrunSection),
23042307
);
@@ -2471,8 +2474,6 @@ export class TrainrunSectionsView {
24712474
connectedTrainIds,
24722475
enableEvents,
24732476
);
2474-
2475-
this.createDirectionArrows(groupLines, selectedTrainrun, connectedTrainIds, enableEvents);
24762477
}
24772478

24782479
private createSingleStopElement(

0 commit comments

Comments
 (0)