@willcgage/module-schematic 0.44.0 → 0.46.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
@@ -1244,12 +1244,15 @@ function moduleFeatures(doc) {
1244
1244
  }));
1245
1245
  const branchConnectors = doc.endplates.filter(
1246
1246
  (e) => e.id !== "A" && e.id !== "B" && e.at && !!e.trackId && (doc.tracks ?? []).some((t) => t.id === e.trackId)
1247
- ).map((e) => ({
1248
- id: e.id,
1249
- label: e.label ?? e.id,
1250
- posFrac: clampFrac(e.at.pos),
1251
- side: e.at.side === "down" ? "down" : "up"
1252
- }));
1247
+ ).map((e) => {
1248
+ const sw = (doc.turnouts ?? []).find((t) => t.divergeTrack === e.trackId);
1249
+ return {
1250
+ id: e.id,
1251
+ label: e.label ?? e.id,
1252
+ posFrac: clampFrac(sw ? sw.pos : e.at.pos),
1253
+ side: e.at.side === "down" ? "down" : "up"
1254
+ };
1255
+ });
1253
1256
  const industries = (doc.industries ?? []).flatMap((ind) => {
1254
1257
  const spots = [
1255
1258
  { track: ind.track, fromPos: ind.fromPos, toPos: ind.toPos, side: ind.side },
@@ -1353,7 +1356,7 @@ function deriveEndplatePoses(geo) {
1353
1356
  trackOffsets: offsetsFor(cfg(0), half)
1354
1357
  })
1355
1358
  );
1356
- const noB = geo.geometryType === "dead_end";
1359
+ const noB = geo.geometryType === "dead_end" || geo.loop === true;
1357
1360
  const end = sectionedEndPose({ sections: geo.sections });
1358
1361
  if (!noB && end) {
1359
1362
  poses.push(