easyeda 0.0.229 → 0.0.230
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/browser/index.js +21 -12
- package/dist/browser/index.js.map +1 -1
- package/dist/index.js +21 -12
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +23 -14
- package/dist/main.cjs.map +1 -1
- package/package.json +2 -2
package/dist/browser/index.js
CHANGED
|
@@ -80281,13 +80281,13 @@ var parseCadOffsetsFromSvgNode = (svgNode) => {
|
|
|
80281
80281
|
};
|
|
80282
80282
|
};
|
|
80283
80283
|
var readModelHeightMm = (raw) => {
|
|
80284
|
-
const fallback =
|
|
80284
|
+
const fallback = 3.5;
|
|
80285
80285
|
if (raw == null) return fallback;
|
|
80286
80286
|
const n2 = Number(raw);
|
|
80287
80287
|
if (!Number.isFinite(n2)) return fallback;
|
|
80288
80288
|
const mmFromMil10 = mil10ToMm(n2);
|
|
80289
80289
|
const mmFromMil = mm(`${n2}mil`);
|
|
80290
|
-
const upper =
|
|
80290
|
+
const upper = 12;
|
|
80291
80291
|
const lower = 0.1;
|
|
80292
80292
|
let chosen = Math.max(mmFromMil10, mmFromMil);
|
|
80293
80293
|
if (chosen > upper || chosen < lower) chosen = fallback;
|
|
@@ -80659,12 +80659,11 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
80659
80659
|
const ROTATE_X_FOR_YUP = 90;
|
|
80660
80660
|
const originalZRotation = (cad.rotation.z ?? 0) % 360;
|
|
80661
80661
|
if (Math.abs(originalZRotation - 0) < 1 || Math.abs(originalZRotation - 360) < 1) {
|
|
80662
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) +
|
|
80662
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
80663
80663
|
} else if (Math.abs(originalZRotation - 180) < 1) {
|
|
80664
80664
|
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
80665
80665
|
} else if (Math.abs(originalZRotation - 90) < 1) {
|
|
80666
|
-
cad.rotation.x = ((cad.rotation.x ?? 0) +
|
|
80667
|
-
cad.rotation.y = ((cad.rotation.y ?? 0) + 270 + 360) % 360;
|
|
80666
|
+
cad.rotation.x = ((cad.rotation.x ?? 0) + 0 + 360) % 360;
|
|
80668
80667
|
} else if (Math.abs(originalZRotation - 270) < 1) {
|
|
80669
80668
|
cad.rotation.x = ((cad.rotation.x ?? 0) + ROTATE_X_FOR_YUP + 360) % 360;
|
|
80670
80669
|
cad.rotation.y = ((cad.rotation.y ?? 0) + 90 + 360) % 360;
|
|
@@ -80677,15 +80676,25 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, { useModelCdn, shouldRecente
|
|
|
80677
80676
|
if (side !== "top") {
|
|
80678
80677
|
cad.rotation.x = ((cad.rotation.x ?? 0) + 180) % 360;
|
|
80679
80678
|
}
|
|
80680
|
-
const
|
|
80679
|
+
const USE_Z_OFFSET_FOR_180 = Math.abs(originalZRotation - 180) < 1;
|
|
80681
80680
|
const zOffRaw = cad.position.z ?? 0;
|
|
80682
|
-
const zOff =
|
|
80681
|
+
const zOff = USE_Z_OFFSET_FOR_180 ? -zOffRaw : 0;
|
|
80683
80682
|
const rx = (cad.rotation.x % 360 + 360) % 360;
|
|
80684
|
-
|
|
80685
|
-
|
|
80686
|
-
|
|
80687
|
-
|
|
80688
|
-
|
|
80683
|
+
let thicknessAlongWorldZ;
|
|
80684
|
+
const is180RotatedYUp = (Math.abs(originalZRotation - 180) < 1 || Math.abs(originalZRotation - 0) < 1 || Math.abs(originalZRotation - 360) < 1) && Math.abs(rx) < 1;
|
|
80685
|
+
if (is180RotatedYUp) {
|
|
80686
|
+
thicknessAlongWorldZ = cad.size.y;
|
|
80687
|
+
} else if (rx % 180 === 90) {
|
|
80688
|
+
thicknessAlongWorldZ = cad.size.y;
|
|
80689
|
+
} else {
|
|
80690
|
+
thicknessAlongWorldZ = cad.size.z;
|
|
80691
|
+
}
|
|
80692
|
+
let centerZ;
|
|
80693
|
+
if (is180RotatedYUp) {
|
|
80694
|
+
centerZ = side === "top" ? t3 - thicknessAlongWorldZ / 2 : -t3 + thicknessAlongWorldZ / 2;
|
|
80695
|
+
} else {
|
|
80696
|
+
centerZ = side === "top" ? t3 + zOff + thicknessAlongWorldZ / 2 : -t3 - zOff - thicknessAlongWorldZ / 2;
|
|
80697
|
+
}
|
|
80689
80698
|
cad.position.z = centerZ;
|
|
80690
80699
|
}
|
|
80691
80700
|
}
|