@openrail/netzgrafik-editor-frontend 2.12.1 → 2.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -120162,7 +120162,7 @@ var SimpleTrainrunSectionRouter = class _SimpleTrainrunSectionRouter {
120162
120162
  y = topLeftPosition.getY();
120163
120163
  } else if (port.getPositionAlignment() === PortAlignment.Bottom) {
120164
120164
  x = topLeftPosition.getX() + TRAINRUN_SECTION_PORT_SPAN_VERTICAL * (0.5 + port.getPositionIndex());
120165
- y = topLeftPosition.getY() + node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT;
120165
+ y = topLeftPosition.getY() + node.getNodeHeight() - node.getNodeTextAreaHeight();
120166
120166
  } else if (port.getPositionAlignment() === PortAlignment.Left) {
120167
120167
  x = topLeftPosition.getX();
120168
120168
  y = topLeftPosition.getY() + TRAINRUN_SECTION_PORT_SPAN_HORIZONTAL * (0.5 + port.getPositionIndex());
@@ -120732,6 +120732,8 @@ var Node3 = class _Node {
120732
120732
  warnings: null,
120733
120733
  labelIds: []
120734
120734
  }) {
120735
+ this.minTextWidth = 0;
120736
+ this.textAreaHeight = NODE_TEXT_AREA_HEIGHT;
120735
120737
  this.id = id2;
120736
120738
  this.betriebspunktName = betriebspunktName;
120737
120739
  this.fullName = fullName;
@@ -120871,6 +120873,15 @@ var Node3 = class _Node {
120871
120873
  this.positionX = x;
120872
120874
  this.positionY = y;
120873
120875
  }
120876
+ setMinTextWidth(minTextWidth) {
120877
+ this.minTextWidth = minTextWidth;
120878
+ }
120879
+ setTextAreaHeight(textAreaHeight) {
120880
+ this.textAreaHeight = textAreaHeight;
120881
+ }
120882
+ getNodeTextAreaHeight() {
120883
+ return this.textAreaHeight;
120884
+ }
120874
120885
  getNodeWidth() {
120875
120886
  let maxIndex = 0;
120876
120887
  this.ports.forEach((port) => {
@@ -120880,7 +120891,7 @@ var Node3 = class _Node {
120880
120891
  }
120881
120892
  }
120882
120893
  });
120883
- return Math.max(NODE_MIN_WIDTH, maxIndex * NODE_PIN_SPAN);
120894
+ return Math.max(NODE_MIN_WIDTH, maxIndex * NODE_PIN_SPAN, this.minTextWidth);
120884
120895
  }
120885
120896
  getNodeHeight() {
120886
120897
  let maxIndex = 0;
@@ -120891,7 +120902,7 @@ var Node3 = class _Node {
120891
120902
  }
120892
120903
  }
120893
120904
  });
120894
- return Math.max(NODE_MIN_HEIGHT, maxIndex * NODE_PIN_SPAN + NODE_TEXT_AREA_HEIGHT);
120905
+ return Math.max(NODE_MIN_HEIGHT + this.textAreaHeight - NODE_TEXT_AREA_HEIGHT, maxIndex * NODE_PIN_SPAN + this.textAreaHeight);
120895
120906
  }
120896
120907
  getPort(portId) {
120897
120908
  return this.ports.find((p) => p.getId() === portId);
@@ -136094,7 +136105,7 @@ var NodeViewObject = class _NodeViewObject {
136094
136105
  this.key = _NodeViewObject.generateKey(editorView, node, isNodeStopNode);
136095
136106
  }
136096
136107
  static generateKey(editorView, n, isNodeStopNode) {
136097
- return "#" + n.getId() + "@" + n.getPositionX() + "_" + n.getPositionY() + "_" + n.getBetriebspunktName() + "_" + n.getPorts().length + "_" + n.getConnectionTime() + "_" + n.getNodeWidth() + "_" + n.getNodeHeight() + "_" + n.selected() + "_" + n.getConnections().length + "_" + isNodeStopNode + "_" + editorView.displayNodesFullName() + "_" + editorView.isJunctionNode(n) + "_" + editorView.isTemporaryDisableFilteringOfItemsInViewEnabled() + "_" + editorView.getLevelOfDetail() + "_" + editorView.trainrunSectionPreviewLineView.getVariantIsWritable();
136108
+ return "#" + n.getId() + "@" + n.getPositionX() + "_" + n.getPositionY() + "_" + n.getBetriebspunktName() + "_" + n.getFullName() + "_" + n.getPorts().length + "_" + n.getConnectionTime() + "_" + n.getNodeWidth() + "_" + n.getNodeHeight() + "_" + n.selected() + "_" + n.getConnections().length + "_" + isNodeStopNode + "_" + editorView.displayNodesFullName() + "_" + editorView.isJunctionNode(n) + "_" + editorView.isTemporaryDisableFilteringOfItemsInViewEnabled() + "_" + editorView.getLevelOfDetail() + "_" + editorView.trainrunSectionPreviewLineView.getVariantIsWritable();
136098
136109
  }
136099
136110
  };
136100
136111
 
@@ -136127,11 +136138,6 @@ var LevelOfDetail;
136127
136138
  LevelOfDetail2[LevelOfDetail2["LEVEL1"] = 3] = "LEVEL1";
136128
136139
  LevelOfDetail2[LevelOfDetail2["LEVEL0"] = 4] = "LEVEL0";
136129
136140
  })(LevelOfDetail || (LevelOfDetail = {}));
136130
- var DYNAMIC_DETAIL_MODES = [
136131
- EditorMode.NetzgrafikEditing,
136132
- EditorMode.MultiNodeMoving,
136133
- EditorMode.NoteEditing
136134
- ];
136135
136141
  var LevelOfDetailService = class _LevelOfDetailService {
136136
136142
  constructor(uiInteractionService) {
136137
136143
  this.uiInteractionService = uiInteractionService;
@@ -136148,9 +136154,6 @@ var LevelOfDetailService = class _LevelOfDetailService {
136148
136154
  handleLevelOfDetail() {
136149
136155
  this.levelOfDetail = LevelOfDetail.FULL;
136150
136156
  this.uiInteractionService.zoomFactorObservable.pipe(takeUntil(this.destroyed)).subscribe((changedZoomFactor) => {
136151
- if (DYNAMIC_DETAIL_MODES.includes(this.uiInteractionService.getEditorMode())) {
136152
- return;
136153
- }
136154
136157
  this.levelOfDetail = LevelOfDetail.FULL;
136155
136158
  if (changedZoomFactor < 50) {
136156
136159
  this.levelOfDetail = LevelOfDetail.LEVEL3;
@@ -136441,6 +136444,8 @@ var NodesView = class {
136441
136444
  constructor(editorView) {
136442
136445
  this.editorView = editorView;
136443
136446
  this.dragDomObj = null;
136447
+ this.textWidthCache = /* @__PURE__ */ new Map();
136448
+ this.measurementText = select_default2("body").append("svg").style("position", "absolute").style("visibility", "hidden").append("text").attr("class", "node_text");
136444
136449
  this.draggable = drag_default().on("start", (event, n) => this.onNodeDragStart(event, n.node)).on("drag", (event, n) => this.onNodeDragged(event, n.node)).on("end", (event, n) => this.onNodeDragEnd(event, n.node));
136445
136450
  this.dragPreviousMousePosition = new Vec2D();
136446
136451
  }
@@ -136490,6 +136495,7 @@ var NodesView = class {
136490
136495
  return this.editorView.isNodeVisible(node);
136491
136496
  }
136492
136497
  displayNodes(inputNodes) {
136498
+ inputNodes.forEach((n) => this.updateNodeDisplayConstraints(n));
136493
136499
  const nodes2 = inputNodes.filter((n) => this.editorView.doCullCheckPositionsInViewport([
136494
136500
  new Vec2D(n.getPositionX(), n.getPositionY()),
136495
136501
  new Vec2D(n.getPositionX() + n.getNodeWidth(), n.getPositionY()),
@@ -136525,21 +136531,14 @@ var NodesView = class {
136525
136531
  }
136526
136532
  }
136527
136533
  }
136528
- adjustTextWithEllipsis(text3) {
136529
- text3.each(function() {
136530
- const text4 = select_default2(this);
136531
- const chars = text4.text().split("");
136532
- const ellipsis2 = text4.text("").append("tspan").attr("class", "elip").text("\u2026");
136533
- const width = parseFloat(text4.attr("width")) - ellipsis2.node().getComputedTextLength();
136534
- const wordLength = chars.length;
136535
- const tspan = text4.insert("tspan", ":first-child").text(chars.join(""));
136536
- while (tspan.node().getComputedTextLength() > width && chars.length) {
136537
- chars.pop();
136538
- tspan.text(chars.join(""));
136539
- }
136540
- if (chars.length === wordLength) {
136541
- ellipsis2.remove();
136542
- }
136534
+ // Renders text lines instead of a single line for the node label
136535
+ renderLabelLines(text3) {
136536
+ text3.nodes().forEach((textElement) => {
136537
+ const element = select_default2(textElement);
136538
+ element.text(null);
136539
+ this.getNodeLabelLines(element.datum().node).forEach((line, index) => {
136540
+ element.append("tspan").attr("x", NODE_TEXT_LEFT_SPACING).attr("dy", index === 0 ? 0 : TEXT_SIZE).text(line);
136541
+ });
136543
136542
  });
136544
136543
  }
136545
136544
  makeNodeLODFull(groupEnter) {
@@ -136563,6 +136562,7 @@ var NodesView = class {
136563
136562
  this.makeNodeRoot(groupEnter);
136564
136563
  this.makeBackground(groupEnter);
136565
136564
  this.makeLabelArea(groupEnter);
136565
+ this.makeHoverDragBackground(groupEnter);
136566
136566
  this.makeNodeDockable(groupEnter);
136567
136567
  this.makeAnalyticsArea(groupEnter);
136568
136568
  this.makeAnalyticsTextLeftArea(groupEnter);
@@ -136575,6 +136575,7 @@ var NodesView = class {
136575
136575
  this.makeNodeRoot(groupEnter);
136576
136576
  this.makeBackground(groupEnter);
136577
136577
  this.makeLabelArea(groupEnter);
136578
+ this.makeHoverDragBackground(groupEnter);
136578
136579
  this.makeNodeDockable(groupEnter);
136579
136580
  this.makeAnalyticsArea(groupEnter);
136580
136581
  this.makeLabelText(groupEnter);
@@ -136583,12 +136584,14 @@ var NodesView = class {
136583
136584
  makeNodeLODLevel1(groupEnter) {
136584
136585
  this.makeNodeHoverRoot(groupEnter);
136585
136586
  this.makeBackground(groupEnter);
136587
+ this.makeHoverDragBackground(groupEnter);
136586
136588
  this.makeNodeDockable(groupEnter);
136587
136589
  this.makeAnalyticsArea(groupEnter);
136588
136590
  this.makeLabelText(groupEnter);
136589
136591
  }
136590
136592
  makeNodeLODLevel0(groupEnter) {
136591
136593
  this.makeNodeHoverRoot(groupEnter);
136594
+ this.makeHoverDragBackground(groupEnter);
136592
136595
  this.makeNodeDockable(groupEnter);
136593
136596
  this.makeAnalyticsArea(groupEnter);
136594
136597
  }
@@ -136602,7 +136605,7 @@ var NodesView = class {
136602
136605
  groupEnter.append(StaticDomTags.NODE_BACKGROUND_SVG).attr("class", StaticDomTags.NODE_BACKGROUND_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("width", (n) => n.node.getNodeWidth()).attr("height", (n) => n.node.getNodeHeight()).attr("x", 0).attr("y", 0).classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).on("mouseover", (event, n) => this.onHoverNodeMouseover(event, n.node)).on("mouseout", (event, n) => this.onHoverNodeMouseout(event, n.node)).on("mousedown", (event, n) => this.onNodeMousedown(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node)).on("dblclick", (event, n) => this.onNodeDetailsClicked(event, n.node));
136603
136606
  }
136604
136607
  makeLabelArea(groupEnter) {
136605
- groupEnter.append(StaticDomTags.NODE_LABELAREA_SVG).attr("class", StaticDomTags.NODE_LABELAREA_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("width", (n) => n.node.getNodeWidth()).attr("height", NODE_TEXT_AREA_HEIGHT).attr("x", 0).attr("y", (n) => n.node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT).classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).on("mouseover", (event, n) => this.onNodeLabelAreaMouseover(event, n.node)).on("mouseout", (event, n) => this.onNodeMouseout(event, n.node)).on("mousedown", (event, n) => this.onNodeMousedown(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node)).on("dblclick", (event, n) => this.onNodeDetailsClicked(event, n.node));
136608
+ groupEnter.append(StaticDomTags.NODE_LABELAREA_SVG).attr("class", StaticDomTags.NODE_LABELAREA_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("width", (n) => n.node.getNodeWidth()).attr("height", (n) => n.node.getNodeTextAreaHeight()).attr("x", 0).attr("y", (n) => n.node.getNodeHeight() - n.node.getNodeTextAreaHeight()).classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).on("mouseover", (event, n) => this.onNodeLabelAreaMouseover(event, n.node)).on("mouseout", (event, n) => this.onNodeMouseout(event, n.node)).on("mousedown", (event, n) => this.onNodeMousedown(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node)).on("dblclick", (event, n) => this.onNodeDetailsClicked(event, n.node));
136606
136609
  }
136607
136610
  makeHoverDragBackground(groupEnter) {
136608
136611
  const added = groupEnter.append(StaticDomTags.NODE_HOVER_DRAG_AREA_BACKGROUND_SVG);
@@ -136625,20 +136628,20 @@ var NodesView = class {
136625
136628
  groupEnter.append(StaticDomTags.NODE_EDIT_AREA_SVG).attr("class", StaticDomTags.NODE_EDIT_AREA_CLASS).classed(StaticDomTags.TAG_SELECTED, (n) => n.node.selected()).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("d", "m25.853 6.71-.354-.352-.353.353-3.435 3.435-.353.354.353.353 3.435 3.435.355.355.353-.355 3.435-3.449.353-.354-.354-.353-3.435-3.421Zm-3.081 3.79 2.729-2.729 2.727 2.717-2.729 2.739-2.727-2.727Zm-2.918 2.212-.354-.354-.354.354-11.25 11.25-.146.146V28.25h4.142l.147-.146 11.25-11.252.353-.353-.354-.354-3.434-3.433ZM8.75 24.522l10.75-10.75 2.728 2.727-10.75 10.751H8.75v-2.728Z").attr("transform", (n) => "translate(" + (n.node.getNodeWidth() + 1) + "," + (n.node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT + 2) + "),scale(0.7)").on("mouseover", (event, n) => this.onNodeMouseoverEditButton(event, n.node)).on("mouseout", (event, n) => this.onNodeMouseoutEditButton(event, n.node)).on("mousedown", (event, n) => this.onNodeDetailsClicked(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node));
136626
136629
  }
136627
136630
  makeNodeDockable(groupEnter) {
136628
- groupEnter.append(StaticDomTags.NODE_DOCKABLE_SVG).attr("class", StaticDomTags.NODE_DOCKABLE_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("width", (n) => n.node.getNodeWidth()).attr("height", (n) => n.node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT).attr("x", 0).attr("y", 0).classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).classed(StaticDomTags.TAG_MULTI_SELECTED, (n) => n.node.selected() && this.editorView.editorMode === EditorMode.MultiNodeMoving).on("mouseover", (event, n) => this.onNodeDockableMouseover(event, n.node)).on("mouseout", (event, n) => this.onNodeDockableMouseout(event, n.node)).on("mousedown", (event, n) => this.onNodeMousedown(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node)).on("dblclick", (event, n) => this.onNodeDetailsClicked(event, n.node));
136631
+ groupEnter.append(StaticDomTags.NODE_DOCKABLE_SVG).attr("class", StaticDomTags.NODE_DOCKABLE_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("width", (n) => n.node.getNodeWidth()).attr("height", (n) => n.node.getNodeHeight() - n.node.getNodeTextAreaHeight()).attr("x", 0).attr("y", 0).classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).classed(StaticDomTags.TAG_MULTI_SELECTED, (n) => n.node.selected() && this.editorView.editorMode === EditorMode.MultiNodeMoving).on("mouseover", (event, n) => this.onNodeDockableMouseover(event, n.node)).on("mouseout", (event, n) => this.onNodeDockableMouseout(event, n.node)).on("mousedown", (event, n) => this.onNodeMousedown(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node)).on("dblclick", (event, n) => this.onNodeDetailsClicked(event, n.node));
136629
136632
  }
136630
136633
  makeAnalyticsArea(groupEnter) {
136631
- groupEnter.append(StaticDomTags.NODE_ANALYTICSAREA_SVG).attr("class", StaticDomTags.NODE_ANALYTICSAREA_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("width", (n) => n.node.getNodeWidth()).attr("height", NODE_ANALYTICS_AREA_HEIGHT).attr("x", 0).attr("y", (n) => n.node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT - 0.75 * NODE_ANALYTICS_AREA_HEIGHT).attr("title", "test").classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).on("mouseover", (event, n) => this.onNodeMouseover(event, n.node)).on("mousemove", (event, n) => this.onNodeMousemove(event, n.node)).on("mouseout", (event, n) => this.onNodeMouseout(event, n.node)).on("mousedown", (event, n) => this.onNodeMousedown(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node));
136634
+ groupEnter.append(StaticDomTags.NODE_ANALYTICSAREA_SVG).attr("class", StaticDomTags.NODE_ANALYTICSAREA_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("width", (n) => n.node.getNodeWidth()).attr("height", NODE_ANALYTICS_AREA_HEIGHT).attr("x", 0).attr("y", (n) => n.node.getNodeHeight() - n.node.getNodeTextAreaHeight() - 0.75 * NODE_ANALYTICS_AREA_HEIGHT).attr("title", "test").classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).on("mouseover", (event, n) => this.onNodeMouseover(event, n.node)).on("mousemove", (event, n) => this.onNodeMousemove(event, n.node)).on("mouseout", (event, n) => this.onNodeMouseout(event, n.node)).on("mousedown", (event, n) => this.onNodeMousedown(event, n.node)).on("mouseup", (event, n) => this.onNodeMouseup(event, n.node));
136632
136635
  }
136633
136636
  makeAnalyticsTextLeftArea(groupEnter) {
136634
- groupEnter.append(StaticDomTags.NODE_ANALYTICSAREA_TEXT_LEFT_SVG).attr("class", StaticDomTags.NODE_ANALYTICSAREA_TEXT_LEFT_CLASS).attr("x", NODE_TEXT_LEFT_SPACING).attr("y", (n) => n.node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT - 0.5 * NODE_ANALYTICS_AREA_HEIGHT - TEXT_SIZE / 2).attr(StaticDomTags.NODE_ID, (n) => n.node.getId());
136637
+ groupEnter.append(StaticDomTags.NODE_ANALYTICSAREA_TEXT_LEFT_SVG).attr("class", StaticDomTags.NODE_ANALYTICSAREA_TEXT_LEFT_CLASS).attr("x", NODE_TEXT_LEFT_SPACING).attr("y", (n) => n.node.getNodeHeight() - n.node.getNodeTextAreaHeight() - 0.5 * NODE_ANALYTICS_AREA_HEIGHT - TEXT_SIZE / 2).attr(StaticDomTags.NODE_ID, (n) => n.node.getId());
136635
136638
  }
136636
136639
  makeAnalyticsTextRightArea(groupEnter) {
136637
- groupEnter.append(StaticDomTags.NODE_ANALYTICSAREA_TEXT_RIGHT_SVG).attr("class", StaticDomTags.NODE_ANALYTICSAREA_TEXT_RIGHT_CLASS).attr("x", (n) => n.node.getNodeWidth() - NODE_TEXT_LEFT_SPACING).attr("y", (n) => n.node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT - 0.5 * NODE_ANALYTICS_AREA_HEIGHT - TEXT_SIZE / 2).attr(StaticDomTags.NODE_ID, (n) => n.node.getId());
136640
+ groupEnter.append(StaticDomTags.NODE_ANALYTICSAREA_TEXT_RIGHT_SVG).attr("class", StaticDomTags.NODE_ANALYTICSAREA_TEXT_RIGHT_CLASS).attr("x", (n) => n.node.getNodeWidth() - NODE_TEXT_LEFT_SPACING).attr("y", (n) => n.node.getNodeHeight() - n.node.getNodeTextAreaHeight() - 0.5 * NODE_ANALYTICS_AREA_HEIGHT - TEXT_SIZE / 2).attr(StaticDomTags.NODE_ID, (n) => n.node.getId());
136638
136641
  }
136639
136642
  makeLabelText(groupEnter) {
136640
136643
  const added = groupEnter.append(StaticDomTags.NODE_LABELAREA_TEXT_SVG);
136641
- added.attr("class", `${StaticDomTags.NODE_LABELAREA_TEXT_CLASS} node_name_text`).attr("data-testid", StaticDomTags.NODE_LABELAREA_TEXT_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("x", NODE_TEXT_LEFT_SPACING).attr("y", (n) => n.node.getNodeHeight() - TEXT_SIZE / 2).attr("width", (n) => this.getNodeLabelTextWidth(n.node)).text((n) => this.editorView.displayNodesFullName() ? n.node.getFullName() : n.node.getBetriebspunktName()).call(this.adjustTextWithEllipsis).classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).classed(StaticDomTags.NODE_READONLY, !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable());
136644
+ added.attr("class", `${StaticDomTags.NODE_LABELAREA_TEXT_CLASS} node_name_text`).attr("data-testid", StaticDomTags.NODE_LABELAREA_TEXT_CLASS).attr(StaticDomTags.NODE_ID, (n) => n.node.getId()).attr("x", NODE_TEXT_LEFT_SPACING).attr("y", (n) => this.getNodeLabelFirstLineY(n.node)).attr("width", (n) => this.getNodeLabelMaxTextWidth(n.node)).call((text3) => this.renderLabelLines(text3)).classed(StaticDomTags.NODE_TAG_JUNCTION_ONLY, (n) => n.node.isNonStopNode()).classed(StaticDomTags.NODE_HAS_CONNECTIONS, (n) => n.node.getConnections().length > 0).classed(StaticDomTags.NODE_READONLY, !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable());
136642
136645
  if (!this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable()) {
136643
136646
  return;
136644
136647
  }
@@ -136906,14 +136909,67 @@ var NodesView = class {
136906
136909
  selectAll_default2(StaticDomTags.EDGE_LINE_PIN_DOM_REF).classed(StaticDomTags.EDGE_LINE_PIN_CONNECTION, false);
136907
136910
  }
136908
136911
  }
136909
- getNodeLabelTextWidth(node) {
136912
+ getDisplayedName(node) {
136913
+ return this.editorView.displayNodesFullName() ? node.getFullName() : node.getBetriebspunktName();
136914
+ }
136915
+ getNodeLabelMaxTextWidth(node) {
136916
+ return node.getNodeWidth() - this.getConnectionTimeTextWidth(node) - NODE_TEXT_LEFT_SPACING;
136917
+ }
136918
+ getNodeLabelLines(node) {
136919
+ return this.splitLabelIntoLines(this.getDisplayedName(node), this.getNodeLabelMaxTextWidth(node));
136920
+ }
136921
+ getNodeLabelFirstLineY(node) {
136922
+ return node.getNodeHeight() - node.getNodeTextAreaHeight() + NODE_TEXT_AREA_HEIGHT - TEXT_SIZE / 2;
136923
+ }
136924
+ getComputedTextLength(text3) {
136925
+ let width = this.textWidthCache.get(text3);
136926
+ if (width === void 0) {
136927
+ width = this.measurementText.text(text3).node().getComputedTextLength();
136928
+ this.textWidthCache.set(text3, width);
136929
+ }
136930
+ return width;
136931
+ }
136932
+ // Words are separated by spaces or hyphens; a hyphen stays attached to the preceding word.
136933
+ splitLabelIntoWords(name) {
136934
+ return name.match(/[^\s-]+-?|-+/g) ?? [];
136935
+ }
136936
+ splitLabelIntoLines(name, maxWidth) {
136937
+ const lines = [];
136938
+ let current = "";
136939
+ this.splitLabelIntoWords(name).forEach((word) => {
136940
+ if (current === "") {
136941
+ current = word;
136942
+ } else {
136943
+ const sep = current.endsWith("-") ? "" : " ";
136944
+ if (this.getComputedTextLength(current + sep + word) <= maxWidth) {
136945
+ current += sep + word;
136946
+ } else {
136947
+ lines.push(current);
136948
+ current = word;
136949
+ }
136950
+ }
136951
+ });
136952
+ if (current !== "" || lines.length === 0) {
136953
+ lines.push(current);
136954
+ }
136955
+ return lines;
136956
+ }
136957
+ getConnectionTimeTextWidth(node) {
136910
136958
  const connectionTime = node.getConnectionTime();
136911
- let width = 0;
136912
- if (connectionTime !== null) {
136913
- width = connectionTime === 0 ? 1 : Math.floor(Math.log10(connectionTime)) + 1;
136959
+ if (connectionTime === null) {
136960
+ return 0;
136914
136961
  }
136915
- const connectionTimeTextWidth = width * TEXT_SIZE;
136916
- return node.getNodeWidth() - connectionTimeTextWidth - NODE_TEXT_LEFT_SPACING;
136962
+ return (connectionTime === 0 ? 1 : Math.floor(Math.log10(connectionTime)) + 1) * TEXT_SIZE;
136963
+ }
136964
+ // Node's width is adapted to fit its longest word, then height to fit all text lines.
136965
+ updateNodeDisplayConstraints(node) {
136966
+ const name = this.getDisplayedName(node);
136967
+ const longestWordWidth = this.splitLabelIntoWords(name).reduce((max4, word) => Math.max(max4, this.getComputedTextLength(word)), 0);
136968
+ const neededWidth = longestWordWidth + this.getConnectionTimeTextWidth(node) + 2 * NODE_TEXT_LEFT_SPACING;
136969
+ const minTextWidth = Math.ceil(neededWidth / RASTERING_BASIC_GRID_SIZE) * RASTERING_BASIC_GRID_SIZE;
136970
+ node.setMinTextWidth(minTextWidth);
136971
+ const lines = this.getNodeLabelLines(node);
136972
+ node.setTextAreaHeight(NODE_TEXT_AREA_HEIGHT + (lines.length - 1) * TEXT_SIZE);
136917
136973
  }
136918
136974
  };
136919
136975
 
@@ -137803,6 +137859,7 @@ var TrainrunSectionsView = class _TrainrunSectionsView {
137803
137859
  if (selectedTrainrun !== null) {
137804
137860
  connectedTrainIds = this.editorView.getConnectedTrainrunIds(selectedTrainrun);
137805
137861
  }
137862
+ trainrunSections.forEach((trainrunSection) => trainrunSection.routeEdgeAndPlaceText());
137806
137863
  const filteredTrainrunSections = trainrunSections.filter((trainrunSection) => this.editorView.doCullCheckPositionsInViewport(trainrunSection.getPath()) && this.filterTrainrunSectionToDisplay(trainrunSection));
137807
137864
  const group2 = this.trainrunSectionGroup.selectAll(StaticDomTags.EDGE_ROOT_CONTAINER_DOM_REF).data(this.createViewTrainrunSectionDataObjects(this.editorView, filteredTrainrunSections), (d) => d.key);
137808
137865
  const edgeRootContainerEnter = group2.enter().append(StaticDomTags.EDGE_SVG).attr("class", StaticDomTags.EDGE_ROOT_CONTAINER).attr(StaticDomTags.EDGE_ID, (d) => d.trainrunSection.getId()).classed(StaticDomTags.TAG_SELECTED, (d) => _TrainrunSectionsView.isSectionSelected(d.trainrunSection)).classed(StaticDomTags.TAG_MUTED, (d) => _TrainrunSectionsView.isMuted(d.trainrunSection, selectedTrainrun, connectedTrainIds));
@@ -138033,7 +138090,7 @@ var TrainrunSectionsView = class _TrainrunSectionsView {
138033
138090
  }
138034
138091
  if (port.getPositionAlignment() === PortAlignment.Bottom) {
138035
138092
  const v = element.copy();
138036
- v.setY(v.getY() - NODE_TEXT_AREA_HEIGHT - NODE_EDGE_WIDTH);
138093
+ v.setY(v.getY() - node.getNodeTextAreaHeight() - NODE_EDGE_WIDTH);
138037
138094
  transformedPath.push(v);
138038
138095
  }
138039
138096
  return transformedPath;
@@ -139608,7 +139665,7 @@ var EditorKeyEvents = class {
139608
139665
  return true;
139609
139666
  }
139610
139667
  onSelectAll() {
139611
- if (DYNAMIC_DETAIL_MODES.includes(this.uiInteractionService.getEditorMode())) {
139668
+ if (this.uiInteractionService.getEditorMode() === EditorMode.MultiNodeMoving || this.uiInteractionService.getEditorMode() === EditorMode.NetzgrafikEditing) {
139612
139669
  this.uiInteractionService.setEditorMode(EditorMode.MultiNodeMoving);
139613
139670
  this.noteService.getNotes().forEach((n) => {
139614
139671
  if (this.filterService.filterNote(n)) {
@@ -145992,7 +146049,7 @@ var AppRoutingModule = class _AppRoutingModule {
145992
146049
  // package.json
145993
146050
  var package_default = {
145994
146051
  name: "@openrail/netzgrafik-editor-frontend",
145995
- version: "2.12.1",
146052
+ version: "2.12.2",
145996
146053
  repository: {
145997
146054
  type: "git",
145998
146055
  url: "https://github.com/OpenRailAssociation/netzgrafik-editor-frontend.git"
@@ -180944,5 +181001,5 @@ if (environment.production) {
180944
181001
  enableProdMode();
180945
181002
  }
180946
181003
  platformBrowser().bootstrapModule(AppModule, { applicationProviders: [provideZoneChangeDetection()] }).catch((err) => console.error(err));
180947
- //# debugId=d0c1f312-ea52-5220-9390-fac5c6394fa0
181004
+ //# debugId=ef72347f-e54b-5e75-b969-7edc9456e381
180948
181005
  //# sourceMappingURL=main.js.map