@willcgage/module-schematic 0.110.0 → 0.112.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
@@ -3566,9 +3566,16 @@ function docToGraph(doc, answers = {}, library = BUILT_IN_TRACK_PARTS) {
3566
3566
  if (!partner) continue;
3567
3567
  used.add(t.id);
3568
3568
  used.add(partner.id);
3569
- mainToMainPairs.push({ a: t, b: partner });
3569
+ mainToMainPairs.push({
3570
+ a: t,
3571
+ b: partner,
3572
+ pairKey: [t.onTrack, t.divergeTrack].sort().join("\u2194")
3573
+ });
3570
3574
  }
3571
3575
  }
3576
+ const crossingsBetween = /* @__PURE__ */ new Map();
3577
+ for (const p of mainToMainPairs)
3578
+ crossingsBetween.set(p.pairKey, (crossingsBetween.get(p.pairKey) ?? 0) + 1);
3572
3579
  const divergeFarOverride = /* @__PURE__ */ new Map();
3573
3580
  for (const { a, b } of mainToMainPairs) {
3574
3581
  divergeFarOverride.set(a.id, b.pos);
@@ -3652,9 +3659,10 @@ function docToGraph(doc, answers = {}, library = BUILT_IN_TRACK_PARTS) {
3652
3659
  rotationDeg: Math.atan2(dy, dx) * 180 / Math.PI,
3653
3660
  lengthInches: r3(len)
3654
3661
  });
3655
- warnings.push(
3656
- `${pair.a.name || pair.a.id} and ${pair.b.name || pair.b.id} are laid as two separate turnouts with a ${len.toFixed(1)}\u2033 piece of track between them, which is what the document describes. If they are really one crossover assembly, name the product on a connector track and it will be laid as the single piece it is.`
3657
- );
3662
+ if ((crossingsBetween.get(pair.pairKey) ?? 1) > 1)
3663
+ warnings.push(
3664
+ `${pair.a.name || pair.a.id} and ${pair.b.name || pair.b.id} are two of four turnouts crossing between the same pair of mains \u2014 a double crossover. They are laid as separate turnouts with a ${len.toFixed(1)}\u2033 piece of track between them, which is what the document describes. If it is really a one-piece double crossover, name the product on a connector track and it will be laid as the single assembly it is.`
3665
+ );
3658
3666
  }
3659
3667
  let progressed = true;
3660
3668
  while (progressed) {