@willcgage/module-schematic 0.49.3 → 0.49.5

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.d.cts CHANGED
@@ -1000,6 +1000,10 @@ interface ModuleFeatures {
1000
1000
  fromFrac: number;
1001
1001
  toFrac: number;
1002
1002
  } | null;
1003
+ /** Main 2's drawn lane — +1 above Main 1 by default, −1 below when the mains
1004
+ * are swapped (#131/#172). Null when there is no Main 2. Renderers must draw
1005
+ * Main 2 (and its diverges) at THIS lane, never a hard-coded +1. */
1006
+ main2Lane: number | null;
1003
1007
  /** Single↔double transition, fully described (#FMN-0043). The `through` main
1004
1008
  * runs the whole module; the `branch` main exists only on the double side and
1005
1009
  * merges at `atFrac`. EITHER main can be through/branch — the surviving single
package/dist/index.d.ts CHANGED
@@ -1000,6 +1000,10 @@ interface ModuleFeatures {
1000
1000
  fromFrac: number;
1001
1001
  toFrac: number;
1002
1002
  } | null;
1003
+ /** Main 2's drawn lane — +1 above Main 1 by default, −1 below when the mains
1004
+ * are swapped (#131/#172). Null when there is no Main 2. Renderers must draw
1005
+ * Main 2 (and its diverges) at THIS lane, never a hard-coded +1. */
1006
+ main2Lane: number | null;
1003
1007
  /** Single↔double transition, fully described (#FMN-0043). The `through` main
1004
1008
  * runs the whole module; the `branch` main exists only on the double side and
1005
1009
  * merges at `atFrac`. EITHER main can be through/branch — the surviving single
package/dist/index.js CHANGED
@@ -462,13 +462,15 @@ function moduleFootprint(input) {
462
462
  const authored = benchworkOutline(input);
463
463
  const offA = input.endplateTrackOffsets?.["A"] ?? 0;
464
464
  const offB = input.endplateTrackOffsets?.["B"] ?? 0;
465
- const sectionOutlines = sectionFootprints(input, {
465
+ const secs = input.sections ?? [];
466
+ const sectionsOwnShape = secs.length > 1 || secs.some((s) => (s.outline?.length ?? 0) >= 3);
467
+ const sectionOutlines = sectionsOwnShape ? sectionFootprints(input, {
466
468
  centerline,
467
469
  widthA,
468
470
  widthB,
469
471
  offsetA: offA,
470
472
  offsetB: offB
471
- });
473
+ }) : [];
472
474
  return {
473
475
  centerline,
474
476
  band: benchworkBand(centerline, widthA, widthB, offA, offB),
@@ -1294,9 +1296,10 @@ function moduleFeatures(doc) {
1294
1296
  };
1295
1297
  });
1296
1298
  });
1299
+ const main2Lane = trackLane.has(MAIN2_TRACK_ID) ? trackLane.get(MAIN2_TRACK_ID) : null;
1297
1300
  const allLanes = [
1298
1301
  0,
1299
- doubleMain ? 1 : 0,
1302
+ main2Lane ?? (doubleMain ? 1 : 0),
1300
1303
  ...extraTracks.map((t) => t.lane),
1301
1304
  ...signals.map((s) => s.lane),
1302
1305
  ...crossings.flatMap((x) => [x.laneA, x.laneB]),
@@ -1324,6 +1327,7 @@ function moduleFeatures(doc) {
1324
1327
  doubleMain,
1325
1328
  loop,
1326
1329
  main2Extent,
1330
+ main2Lane,
1327
1331
  transition,
1328
1332
  loopInterchange: loop && doc.endplates.filter((e) => !e.at).length >= 2,
1329
1333
  loopReturn: loop && doc.loopReturn === "main2" ? "main2" : "same",