@willcgage/module-schematic 0.61.0 → 0.62.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
@@ -669,7 +669,7 @@ function buildTransition(state) {
669
669
  }
670
670
  function withPoses(endplates, overrides) {
671
671
  return endplates.map(
672
- (e) => overrides[e.id] ? { ...e, pose: overrides[e.id] } : e
672
+ (e) => overrides[e.id] ? { ...e, pose: overrides[e.id], poseAuthored: true } : e
673
673
  );
674
674
  }
675
675
  function withWidths(endplates, widths, offsets = {}) {
@@ -2033,10 +2033,26 @@ function trackMeetsEndplateIssues(path, pose, opts) {
2033
2033
  function poseNeedsManual(geometryType) {
2034
2034
  return geometryType === "wye" || geometryType === "other";
2035
2035
  }
2036
+ function isAxialPose(p) {
2037
+ const h = norm360(p.heading);
2038
+ return Math.abs(p.y) < 1e-6 && (Math.abs(h) < 1e-6 || Math.abs(h - 180) < 1e-6);
2039
+ }
2036
2040
  function poseOverridesFromDoc(doc) {
2037
2041
  const out = {};
2038
2042
  for (const e of doc.endplates ?? []) {
2039
- if (e.id && e.pose && typeof e.pose.x === "number" && typeof e.pose.y === "number" && typeof e.pose.heading === "number") {
2043
+ if (e.id && e.pose && typeof e.pose.x === "number" && typeof e.pose.y === "number" && typeof e.pose.heading === "number" && // Only an AUTHORED pose overrides derivation (#182) — but docs written
2044
+ // before the flag existed have to keep working, so authorship is inferred
2045
+ // for the two cases that can only BE authored:
2046
+ // · a placed branch endplate (`at`) — dropping it on the board is the
2047
+ // gesture, and it has no derivable position at all;
2048
+ // · an OFF-AXIS pose on A/B — a hand-placed plate is off-axis by
2049
+ // definition (that's why it needed hand placing, e.g. a wye's B).
2050
+ // What's left is an axial A/B pose, which is exactly the shape plain
2051
+ // derivation produces — residue. Honouring it silently pins the plate so
2052
+ // it stops following the module and goes stale (FMN-0068's B sat at 48 on
2053
+ // a 47.9″ board). Anything saved from now on carries the flag, so this
2054
+ // guesswork only ever applies to old docs.
2055
+ (e.poseAuthored === true || !!e.at || !isAxialPose(e.pose))) {
2040
2056
  out[e.id] = { x: e.pose.x, y: e.pose.y, heading: e.pose.heading };
2041
2057
  }
2042
2058
  }