@willcgage/module-schematic 0.65.0 → 0.66.0

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/index.cjs CHANGED
@@ -1779,8 +1779,9 @@ function moduleFeatures(doc) {
1779
1779
  ...crossings.flatMap((x) => [x.laneA, x.laneB]),
1780
1780
  ...crossovers.flatMap((x) => [x.fromLane, x.toLane])
1781
1781
  ];
1782
- let upLane = Math.max(...baseLanes, 0);
1783
- let downLane = Math.min(...baseLanes, 0);
1782
+ const LANE_GAP_FROM_OTHERS = 2;
1783
+ let upLane = Math.max(...baseLanes, 0) + (LANE_GAP_FROM_OTHERS - 1);
1784
+ let downLane = Math.min(...baseLanes, 0) - (LANE_GAP_FROM_OTHERS - 1);
1784
1785
  const branchConnectors = doc.endplates.filter(
1785
1786
  (e) => e.id !== "A" && e.id !== "B" && e.at && !!e.trackId && (doc.tracks ?? []).some((t) => t.id === e.trackId)
1786
1787
  ).map((e) => {
@@ -1791,10 +1792,6 @@ function moduleFeatures(doc) {
1791
1792
  const lane = side === "down" ? --downLane : ++upLane;
1792
1793
  const runInches = pathLengthInches(trk.path) || Math.abs(e.at.pos - startPos) || FREEMO_ENDPLATE_WIDTH_MIN_INCHES;
1793
1794
  const toB = e.at.pos >= startPos;
1794
- const fits = (p) => p >= 0 && p <= len;
1795
- const ahead = startPos + runInches;
1796
- const behind = startPos - runInches;
1797
- const endPos = toB && fits(ahead) ? ahead : !toB && fits(behind) ? behind : fits(toB ? behind : ahead) ? toB ? behind : ahead : ahead;
1798
1795
  return {
1799
1796
  id: e.id,
1800
1797
  label: e.label ?? e.id,
@@ -1805,7 +1802,7 @@ function moduleFeatures(doc) {
1805
1802
  fromLane: sw ? trackLane.get(sw.onTrack) ?? 0 : 0,
1806
1803
  side,
1807
1804
  lane,
1808
- endFrac: clampFrac(endPos),
1805
+ endFrac: toB ? 1 : 0,
1809
1806
  lengthInches: runInches
1810
1807
  };
1811
1808
  });