@tscircuit/core 0.0.809 → 0.0.811
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.js +20 -12
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8391,7 +8391,6 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8391
8391
|
if (!cadModel && !footprint) return;
|
|
8392
8392
|
if (cadModel === null) return;
|
|
8393
8393
|
const bounds = this._getPcbCircuitJsonBounds();
|
|
8394
|
-
const pcb_component = db.pcb_component.get(this.pcb_component_id);
|
|
8395
8394
|
if (typeof cadModel === "string") {
|
|
8396
8395
|
throw new Error("String cadModel not yet implemented");
|
|
8397
8396
|
}
|
|
@@ -8413,10 +8412,10 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8413
8412
|
const computedLayer = this.props.layer === "bottom" ? "bottom" : "top";
|
|
8414
8413
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
8415
8414
|
const decomposedTransform = decomposeTSR5(globalTransform);
|
|
8416
|
-
const
|
|
8417
|
-
const
|
|
8418
|
-
const rotationWithOffset =
|
|
8419
|
-
const cadRotationZ =
|
|
8415
|
+
const totalRotation = decomposedTransform.rotation.angle * 180 / Math.PI;
|
|
8416
|
+
const isBottomLayer = computedLayer === "bottom";
|
|
8417
|
+
const rotationWithOffset = totalRotation + (rotationOffset.z ?? 0);
|
|
8418
|
+
const cadRotationZ = normalizeDegrees(rotationWithOffset);
|
|
8420
8419
|
const cad_model = db.cad_component.insert({
|
|
8421
8420
|
// TODO z maybe depends on layer
|
|
8422
8421
|
position: {
|
|
@@ -8426,8 +8425,8 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
8426
8425
|
},
|
|
8427
8426
|
rotation: {
|
|
8428
8427
|
x: rotationOffset.x,
|
|
8429
|
-
y:
|
|
8430
|
-
z: cadRotationZ
|
|
8428
|
+
y: rotationOffset.y + (isBottomLayer ? 180 : 0),
|
|
8429
|
+
z: normalizeDegrees(isBottomLayer ? -cadRotationZ : cadRotationZ)
|
|
8431
8430
|
},
|
|
8432
8431
|
pcb_component_id: this.pcb_component_id,
|
|
8433
8432
|
source_component_id: this.source_component_id,
|
|
@@ -13454,16 +13453,25 @@ import {
|
|
|
13454
13453
|
checkPcbComponentOverlap
|
|
13455
13454
|
} from "@tscircuit/checks";
|
|
13456
13455
|
import { getBoundsFromPoints as getBoundsFromPoints4 } from "@tscircuit/math-utils";
|
|
13456
|
+
var MIN_EFFECTIVE_BORDER_RADIUS_MM = 0.01;
|
|
13457
13457
|
var getRoundedRectOutline = (width, height, radius) => {
|
|
13458
|
-
const
|
|
13458
|
+
const w2 = width / 2;
|
|
13459
|
+
const h2 = height / 2;
|
|
13460
|
+
const r = Math.min(radius, w2, h2);
|
|
13461
|
+
if (r < MIN_EFFECTIVE_BORDER_RADIUS_MM) {
|
|
13462
|
+
return [
|
|
13463
|
+
{ x: -w2, y: -h2 },
|
|
13464
|
+
{ x: w2, y: -h2 },
|
|
13465
|
+
{ x: w2, y: h2 },
|
|
13466
|
+
{ x: -w2, y: h2 }
|
|
13467
|
+
];
|
|
13468
|
+
}
|
|
13459
13469
|
const maxArcLengthPerSegment = 0.1;
|
|
13460
13470
|
const segments = Math.max(
|
|
13461
13471
|
1,
|
|
13462
13472
|
Math.ceil(Math.PI / 2 * r / maxArcLengthPerSegment)
|
|
13463
13473
|
);
|
|
13464
13474
|
const step = Math.PI / 2 / segments;
|
|
13465
|
-
const w2 = width / 2;
|
|
13466
|
-
const h2 = height / 2;
|
|
13467
13475
|
const outline = [];
|
|
13468
13476
|
outline.push({ x: -w2 + r, y: -h2 });
|
|
13469
13477
|
outline.push({ x: w2 - r, y: -h2 });
|
|
@@ -17211,7 +17219,7 @@ import { identity as identity6 } from "transformation-matrix";
|
|
|
17211
17219
|
var package_default = {
|
|
17212
17220
|
name: "@tscircuit/core",
|
|
17213
17221
|
type: "module",
|
|
17214
|
-
version: "0.0.
|
|
17222
|
+
version: "0.0.810",
|
|
17215
17223
|
types: "dist/index.d.ts",
|
|
17216
17224
|
main: "dist/index.js",
|
|
17217
17225
|
module: "dist/index.js",
|
|
@@ -17268,7 +17276,7 @@ var package_default = {
|
|
|
17268
17276
|
"circuit-json": "^0.0.288",
|
|
17269
17277
|
"circuit-json-to-bpc": "^0.0.13",
|
|
17270
17278
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
17271
|
-
"circuit-json-to-gltf": "^0.0.
|
|
17279
|
+
"circuit-json-to-gltf": "^0.0.28",
|
|
17272
17280
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
17273
17281
|
"circuit-json-to-spice": "^0.0.15",
|
|
17274
17282
|
"circuit-to-svg": "^0.0.250",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.811",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"circuit-json": "^0.0.288",
|
|
59
59
|
"circuit-json-to-bpc": "^0.0.13",
|
|
60
60
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
61
|
-
"circuit-json-to-gltf": "^0.0.
|
|
61
|
+
"circuit-json-to-gltf": "^0.0.28",
|
|
62
62
|
"circuit-json-to-simple-3d": "^0.0.9",
|
|
63
63
|
"circuit-json-to-spice": "^0.0.15",
|
|
64
64
|
"circuit-to-svg": "^0.0.250",
|