@willcgage/module-schematic 0.43.0 → 0.45.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.js CHANGED
@@ -1240,12 +1240,17 @@ function moduleFeatures(doc) {
1240
1240
  laneA: trackLane.get(x.tracks?.[0] ?? "") ?? 0,
1241
1241
  laneB: trackLane.get(x.tracks?.[1] ?? "") ?? 1
1242
1242
  }));
1243
- const branchConnectors = doc.endplates.filter((e) => e.id !== "A" && e.id !== "B" && e.at).map((e) => ({
1244
- id: e.id,
1245
- label: e.label ?? e.id,
1246
- posFrac: clampFrac(e.at.pos),
1247
- side: e.at.side === "down" ? "down" : "up"
1248
- }));
1243
+ const branchConnectors = doc.endplates.filter(
1244
+ (e) => e.id !== "A" && e.id !== "B" && e.at && !!e.trackId && (doc.tracks ?? []).some((t) => t.id === e.trackId)
1245
+ ).map((e) => {
1246
+ const sw = (doc.turnouts ?? []).find((t) => t.divergeTrack === e.trackId);
1247
+ return {
1248
+ id: e.id,
1249
+ label: e.label ?? e.id,
1250
+ posFrac: clampFrac(sw ? sw.pos : e.at.pos),
1251
+ side: e.at.side === "down" ? "down" : "up"
1252
+ };
1253
+ });
1249
1254
  const industries = (doc.industries ?? []).flatMap((ind) => {
1250
1255
  const spots = [
1251
1256
  { track: ind.track, fromPos: ind.fromPos, toPos: ind.toPos, side: ind.side },