@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 +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -117,6 +117,13 @@ interface SchematicTurnout {
|
|
|
117
117
|
* the same way) instead of leaving as a straight diagonal. Physical-render
|
|
118
118
|
* only; the operations view stays topological. */
|
|
119
119
|
curved?: boolean | null;
|
|
120
|
+
/** Rotate the turnout 180° — the points face the other way along the track.
|
|
121
|
+
* HAND is which turnout you own; how it's INSTALLED is a separate choice, and
|
|
122
|
+
* the drawn orientation can't always be inferred from where the diverging
|
|
123
|
+
* track happens to run. A siding at the far end of a module is the case that
|
|
124
|
+
* forces it: the body has nowhere to go but back toward the module, so the
|
|
125
|
+
* derived facing comes out backwards. */
|
|
126
|
+
flipped?: boolean | null;
|
|
120
127
|
}
|
|
121
128
|
interface SchematicSignal {
|
|
122
129
|
id: string;
|
|
@@ -600,6 +607,8 @@ interface EditorTurnout {
|
|
|
600
607
|
kind: TurnoutKind;
|
|
601
608
|
/** Frog number ("size") — #4, #6, #8, etc. Governs the diverging angle. */
|
|
602
609
|
size?: number;
|
|
610
|
+
/** Rotate the turnout 180° — the points face the other way (#turnout-flip). */
|
|
611
|
+
flipped?: boolean;
|
|
603
612
|
/** A curved turnout — the diverging route bows into an arc rather than a
|
|
604
613
|
* straight diagonal. Physical-render only (the operations view is topological). */
|
|
605
614
|
curved?: boolean;
|
|
@@ -912,7 +921,10 @@ interface ModuleFeatures {
|
|
|
912
921
|
* right-hand throws to the opposite side. `kind` is the source of truth for the
|
|
913
922
|
* drawn side (#bug1) — the stored lane's sign is reconciled to match it.
|
|
914
923
|
*/
|
|
915
|
-
declare function divergeSideForHand(kind: TurnoutKind | undefined, stubDir: number
|
|
924
|
+
declare function divergeSideForHand(kind: TurnoutKind | undefined, stubDir: number,
|
|
925
|
+
/** The turnout is installed the other way round — the points face the far
|
|
926
|
+
* direction, which swaps the side the diverging route leaves on. */
|
|
927
|
+
flipped?: boolean | null): -1 | 0 | 1;
|
|
916
928
|
/**
|
|
917
929
|
* Resolve a schematic doc into positioned drawables. `pos` (inches) becomes a
|
|
918
930
|
* fraction of the module length; endplate A = 0, B = length; turnouts sit at
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,13 @@ interface SchematicTurnout {
|
|
|
117
117
|
* the same way) instead of leaving as a straight diagonal. Physical-render
|
|
118
118
|
* only; the operations view stays topological. */
|
|
119
119
|
curved?: boolean | null;
|
|
120
|
+
/** Rotate the turnout 180° — the points face the other way along the track.
|
|
121
|
+
* HAND is which turnout you own; how it's INSTALLED is a separate choice, and
|
|
122
|
+
* the drawn orientation can't always be inferred from where the diverging
|
|
123
|
+
* track happens to run. A siding at the far end of a module is the case that
|
|
124
|
+
* forces it: the body has nowhere to go but back toward the module, so the
|
|
125
|
+
* derived facing comes out backwards. */
|
|
126
|
+
flipped?: boolean | null;
|
|
120
127
|
}
|
|
121
128
|
interface SchematicSignal {
|
|
122
129
|
id: string;
|
|
@@ -600,6 +607,8 @@ interface EditorTurnout {
|
|
|
600
607
|
kind: TurnoutKind;
|
|
601
608
|
/** Frog number ("size") — #4, #6, #8, etc. Governs the diverging angle. */
|
|
602
609
|
size?: number;
|
|
610
|
+
/** Rotate the turnout 180° — the points face the other way (#turnout-flip). */
|
|
611
|
+
flipped?: boolean;
|
|
603
612
|
/** A curved turnout — the diverging route bows into an arc rather than a
|
|
604
613
|
* straight diagonal. Physical-render only (the operations view is topological). */
|
|
605
614
|
curved?: boolean;
|
|
@@ -912,7 +921,10 @@ interface ModuleFeatures {
|
|
|
912
921
|
* right-hand throws to the opposite side. `kind` is the source of truth for the
|
|
913
922
|
* drawn side (#bug1) — the stored lane's sign is reconciled to match it.
|
|
914
923
|
*/
|
|
915
|
-
declare function divergeSideForHand(kind: TurnoutKind | undefined, stubDir: number
|
|
924
|
+
declare function divergeSideForHand(kind: TurnoutKind | undefined, stubDir: number,
|
|
925
|
+
/** The turnout is installed the other way round — the points face the far
|
|
926
|
+
* direction, which swaps the side the diverging route leaves on. */
|
|
927
|
+
flipped?: boolean | null): -1 | 0 | 1;
|
|
916
928
|
/**
|
|
917
929
|
* Resolve a schematic doc into positioned drawables. `pos` (inches) becomes a
|
|
918
930
|
* fraction of the module length; endplate A = 0, B = length; turnouts sit at
|
package/dist/index.js
CHANGED
|
@@ -714,7 +714,8 @@ function stateToDoc(state, recordNumber) {
|
|
|
714
714
|
kind: t.kind,
|
|
715
715
|
name: t.name || void 0,
|
|
716
716
|
...t.size ? { size: t.size } : {},
|
|
717
|
-
...t.curved ? { curved: true } : {}
|
|
717
|
+
...t.curved ? { curved: true } : {},
|
|
718
|
+
...t.flipped ? { flipped: true } : {}
|
|
718
719
|
})),
|
|
719
720
|
...state.crossings.length > 0 ? {
|
|
720
721
|
crossings: state.crossings.map((x) => ({
|
|
@@ -885,7 +886,8 @@ function docToState(doc, fallbackLength, moduleTracks = []) {
|
|
|
885
886
|
divergeTrack: t.divergeTrack,
|
|
886
887
|
kind: t.kind ?? "right",
|
|
887
888
|
...t.size ? { size: t.size } : {},
|
|
888
|
-
...t.curved ? { curved: true } : {}
|
|
889
|
+
...t.curved ? { curved: true } : {},
|
|
890
|
+
...t.flipped ? { flipped: true } : {}
|
|
889
891
|
})),
|
|
890
892
|
controlPoints: readControlPoints(d, sc),
|
|
891
893
|
industries: (d.industries ?? []).map((ind) => ({
|
|
@@ -1018,9 +1020,9 @@ function buildCrossover(state) {
|
|
|
1018
1020
|
];
|
|
1019
1021
|
return { track, turnouts };
|
|
1020
1022
|
}
|
|
1021
|
-
function divergeSideForHand(kind, stubDir) {
|
|
1023
|
+
function divergeSideForHand(kind, stubDir, flipped) {
|
|
1022
1024
|
if (kind !== "left" && kind !== "right") return 0;
|
|
1023
|
-
const s = stubDir >= 0 ? 1 : -1;
|
|
1025
|
+
const s = (stubDir >= 0 ? 1 : -1) * (flipped ? -1 : 1);
|
|
1024
1026
|
return kind === "left" ? s : -s;
|
|
1025
1027
|
}
|
|
1026
1028
|
function moduleFeatures(doc) {
|