@willcgage/module-schematic 0.101.0 → 0.102.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 +30 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3244,6 +3244,35 @@ function docToGraph(doc, answers = {}, library = BUILT_IN_TRACK_PARTS) {
|
|
|
3244
3244
|
notLaid.push({ id: branch.id, why: `turnout ${t.id} has no diverging end to leave from` });
|
|
3245
3245
|
continue;
|
|
3246
3246
|
}
|
|
3247
|
+
const farSw0 = turnouts.find(
|
|
3248
|
+
(o) => o.id !== t.id && o.divergeTrack === branch.id && laidTurnouts.has(o.id)
|
|
3249
|
+
);
|
|
3250
|
+
const farJoint0 = farSw0 ? (() => {
|
|
3251
|
+
const f = laidTurnouts.get(farSw0.id);
|
|
3252
|
+
return jointAt(f.piece, f.divergeId);
|
|
3253
|
+
})() : null;
|
|
3254
|
+
if (branch.role === "crossover" && farJoint0) {
|
|
3255
|
+
const dx = farJoint0.x - dj.x;
|
|
3256
|
+
const dy = farJoint0.y - dj.y;
|
|
3257
|
+
const len = Math.hypot(dx, dy);
|
|
3258
|
+
if (len > 1e-6) {
|
|
3259
|
+
pieces.push({
|
|
3260
|
+
id: `x-${branch.id}`,
|
|
3261
|
+
partId: flexId,
|
|
3262
|
+
x: dj.x,
|
|
3263
|
+
y: dj.y,
|
|
3264
|
+
rotationDeg: Math.atan2(dy, dx) * 180 / Math.PI,
|
|
3265
|
+
lengthInches: r3(len),
|
|
3266
|
+
...branch.trackName ? { name: branch.trackName } : {}
|
|
3267
|
+
});
|
|
3268
|
+
} else {
|
|
3269
|
+
notLaid.push({
|
|
3270
|
+
id: branch.id,
|
|
3271
|
+
why: "this crossover's two turnouts meet at the same point, so there is no connector between them to lay"
|
|
3272
|
+
});
|
|
3273
|
+
}
|
|
3274
|
+
continue;
|
|
3275
|
+
}
|
|
3247
3276
|
const branchY = laneOffsetAt(branch.lane ?? 0, 0);
|
|
3248
3277
|
const curve = transition(branch.id, { x: dj.x, y: dj.y, headingDeg: dj.headingDeg }, branchY);
|
|
3249
3278
|
let start = { x: dj.x, y: dj.y, headingDeg: dj.headingDeg };
|
|
@@ -3252,13 +3281,7 @@ function docToGraph(doc, answers = {}, library = BUILT_IN_TRACK_PARTS) {
|
|
|
3252
3281
|
const e = jointAt(curve, "b");
|
|
3253
3282
|
if (e) start = { x: e.x, y: e.y, headingDeg: e.headingDeg };
|
|
3254
3283
|
}
|
|
3255
|
-
const
|
|
3256
|
-
(o) => o.id !== t.id && o.divergeTrack === branch.id && laidTurnouts.has(o.id)
|
|
3257
|
-
);
|
|
3258
|
-
const farJoint = farSw ? (() => {
|
|
3259
|
-
const f = laidTurnouts.get(farSw.id);
|
|
3260
|
-
return jointAt(f.piece, f.divergeId);
|
|
3261
|
-
})() : null;
|
|
3284
|
+
const farJoint = farJoint0;
|
|
3262
3285
|
let endX = farJoint != null ? farJoint.x : Math.max(branch.fromPos ?? t.pos, branch.toPos ?? t.pos);
|
|
3263
3286
|
let farCurve = null;
|
|
3264
3287
|
if (farJoint) {
|