@willcgage/module-schematic 0.110.0 → 0.111.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
@@ -3564,9 +3564,16 @@ function docToGraph(doc, answers = {}, library = BUILT_IN_TRACK_PARTS) {
3564
3564
  if (!partner) continue;
3565
3565
  used.add(t.id);
3566
3566
  used.add(partner.id);
3567
- mainToMainPairs.push({ a: t, b: partner });
3567
+ mainToMainPairs.push({
3568
+ a: t,
3569
+ b: partner,
3570
+ pairKey: [t.onTrack, t.divergeTrack].sort().join("\u2194")
3571
+ });
3568
3572
  }
3569
3573
  }
3574
+ const crossingsBetween = /* @__PURE__ */ new Map();
3575
+ for (const p of mainToMainPairs)
3576
+ crossingsBetween.set(p.pairKey, (crossingsBetween.get(p.pairKey) ?? 0) + 1);
3570
3577
  const divergeFarOverride = /* @__PURE__ */ new Map();
3571
3578
  for (const { a, b } of mainToMainPairs) {
3572
3579
  divergeFarOverride.set(a.id, b.pos);
@@ -3650,9 +3657,10 @@ function docToGraph(doc, answers = {}, library = BUILT_IN_TRACK_PARTS) {
3650
3657
  rotationDeg: Math.atan2(dy, dx) * 180 / Math.PI,
3651
3658
  lengthInches: r3(len)
3652
3659
  });
3653
- warnings.push(
3654
- `${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.`
3655
- );
3660
+ if ((crossingsBetween.get(pair.pairKey) ?? 1) > 1)
3661
+ warnings.push(
3662
+ `${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.`
3663
+ );
3656
3664
  }
3657
3665
  let progressed = true;
3658
3666
  while (progressed) {