@willcgage/module-schematic 0.34.0 → 0.35.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
@@ -716,7 +716,8 @@ function stateToDoc(state, recordNumber) {
716
716
  kind: t.kind,
717
717
  name: t.name || void 0,
718
718
  ...t.size ? { size: t.size } : {},
719
- ...t.curved ? { curved: true } : {}
719
+ ...t.curved ? { curved: true } : {},
720
+ ...t.flipped ? { flipped: true } : {}
720
721
  })),
721
722
  ...state.crossings.length > 0 ? {
722
723
  crossings: state.crossings.map((x) => ({
@@ -887,7 +888,8 @@ function docToState(doc, fallbackLength, moduleTracks = []) {
887
888
  divergeTrack: t.divergeTrack,
888
889
  kind: t.kind ?? "right",
889
890
  ...t.size ? { size: t.size } : {},
890
- ...t.curved ? { curved: true } : {}
891
+ ...t.curved ? { curved: true } : {},
892
+ ...t.flipped ? { flipped: true } : {}
891
893
  })),
892
894
  controlPoints: readControlPoints(d, sc),
893
895
  industries: (d.industries ?? []).map((ind) => ({
@@ -1020,9 +1022,9 @@ function buildCrossover(state) {
1020
1022
  ];
1021
1023
  return { track, turnouts };
1022
1024
  }
1023
- function divergeSideForHand(kind, stubDir) {
1025
+ function divergeSideForHand(kind, stubDir, flipped) {
1024
1026
  if (kind !== "left" && kind !== "right") return 0;
1025
- const s = stubDir >= 0 ? 1 : -1;
1027
+ const s = (stubDir >= 0 ? 1 : -1) * (flipped ? -1 : 1);
1026
1028
  return kind === "left" ? s : -s;
1027
1029
  }
1028
1030
  function moduleFeatures(doc) {