@willcgage/module-schematic 0.21.0 → 0.23.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
@@ -108,6 +108,7 @@ var DEG_FP = Math.PI / 180;
108
108
  function moduleCenterline(input) {
109
109
  const drawn = trackPath(input.mainPath);
110
110
  if (drawn) return samplePath(drawn);
111
+ if (!input.geometryType) return [];
111
112
  const L = input.lengthInches > 0 ? input.lengthInches : 24;
112
113
  const gt = input.geometryType;
113
114
  if (gt === "dead_end") return [{ x: 0, y: 0 }];
@@ -216,6 +217,7 @@ function emptyEditorState(lengthInches) {
216
217
  poseOverrides: {},
217
218
  endplateWidths: {},
218
219
  outline: [],
220
+ sectionBreaks: [],
219
221
  controlPoints: [],
220
222
  industries: [],
221
223
  mainPath: []
@@ -409,6 +411,8 @@ function stateToDoc(state, recordNumber) {
409
411
  // Benchwork footprint outline (module-local inches); only when it's a real
410
412
  // ring (≥ 3 vertices).
411
413
  ...state.outline.length >= 3 ? { outline: state.outline } : {},
414
+ // Internal section joints (inches from A), when the module has more than one.
415
+ ...state.sectionBreaks.length ? { sectionBreaks: state.sectionBreaks } : {},
412
416
  // Authored mainline path (module-local inches); only when it's a real path.
413
417
  ...state.mainPath.length >= 2 ? { mainPath: state.mainPath } : {}
414
418
  };
@@ -508,6 +512,7 @@ function docToState(doc, fallbackLength, moduleTracks = []) {
508
512
  poseOverrides,
509
513
  endplateWidths,
510
514
  outline,
515
+ sectionBreaks: (d.sectionBreaks ?? []).filter((n) => Number.isFinite(n)).map((n) => sc(n)),
511
516
  mainPath,
512
517
  crossings: (d.crossings ?? []).map((x) => ({
513
518
  id: x.id,