@tscircuit/core 0.0.168 → 0.0.170
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 +39 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2905,7 +2905,6 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2905
2905
|
});
|
|
2906
2906
|
}
|
|
2907
2907
|
doInitialPartsEngineRender() {
|
|
2908
|
-
console.log("doInitialPartsEngineRender", this);
|
|
2909
2908
|
const { partsEngine } = this.getSubcircuit()._parsedProps;
|
|
2910
2909
|
if (!partsEngine) return;
|
|
2911
2910
|
const { db } = this.root;
|
|
@@ -2933,7 +2932,6 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
2933
2932
|
}
|
|
2934
2933
|
updatePartsEngineRender() {
|
|
2935
2934
|
const { db } = this.root;
|
|
2936
|
-
console.log("updatePartsEngineRender", this);
|
|
2937
2935
|
const source_component = db.source_component.get(this.source_component_id);
|
|
2938
2936
|
if (!source_component) return;
|
|
2939
2937
|
if (source_component.supplier_part_numbers) return;
|
|
@@ -3470,12 +3468,29 @@ function getDominantDirection(edge) {
|
|
|
3470
3468
|
}
|
|
3471
3469
|
|
|
3472
3470
|
// lib/utils/schematic/getStubEdges.ts
|
|
3471
|
+
import { distance } from "@tscircuit/math-utils";
|
|
3473
3472
|
var getStubEdges = ({
|
|
3473
|
+
firstEdge,
|
|
3474
|
+
firstEdgePort,
|
|
3475
|
+
firstDominantDirection,
|
|
3474
3476
|
lastEdge,
|
|
3475
3477
|
lastEdgePort,
|
|
3476
3478
|
lastDominantDirection
|
|
3477
3479
|
}) => {
|
|
3478
|
-
|
|
3480
|
+
if (firstEdge && firstEdgePort) {
|
|
3481
|
+
return getStubEdges({
|
|
3482
|
+
lastEdge: {
|
|
3483
|
+
from: firstEdge.to,
|
|
3484
|
+
to: firstEdge.from
|
|
3485
|
+
},
|
|
3486
|
+
lastEdgePort: firstEdgePort,
|
|
3487
|
+
lastDominantDirection: firstDominantDirection
|
|
3488
|
+
}).reverse().map((e) => ({
|
|
3489
|
+
from: e.to,
|
|
3490
|
+
to: e.from
|
|
3491
|
+
}));
|
|
3492
|
+
}
|
|
3493
|
+
let edges = [];
|
|
3479
3494
|
if (lastEdge && lastEdgePort) {
|
|
3480
3495
|
const intermediatePoint = { x: lastEdge.to.x, y: lastEdge.to.y };
|
|
3481
3496
|
if (lastDominantDirection === "left" || lastDominantDirection === "right") {
|
|
@@ -3500,6 +3515,7 @@ var getStubEdges = ({
|
|
|
3500
3515
|
});
|
|
3501
3516
|
}
|
|
3502
3517
|
}
|
|
3518
|
+
edges = edges.filter((e) => distance(e.from, e.to) > 0.01);
|
|
3503
3519
|
return edges;
|
|
3504
3520
|
};
|
|
3505
3521
|
|
|
@@ -3581,6 +3597,7 @@ var pushEdgesOfSchematicTraceToPreventOverlap = ({
|
|
|
3581
3597
|
|
|
3582
3598
|
// lib/components/primitive-components/Trace/create-schematic-trace-crossing-segments.ts
|
|
3583
3599
|
import { doesLineIntersectLine as doesLineIntersectLine2 } from "@tscircuit/math-utils";
|
|
3600
|
+
import { getUnitVectorFromPointAToB } from "@tscircuit/math-utils";
|
|
3584
3601
|
var createSchematicTraceCrossingSegments = ({
|
|
3585
3602
|
edges,
|
|
3586
3603
|
db,
|
|
@@ -3606,14 +3623,19 @@ var createSchematicTraceCrossingSegments = ({
|
|
|
3606
3623
|
const intersectX = edgeOrientation === "vertical" ? edge.from.x : otherEdge.from.x;
|
|
3607
3624
|
const intersectY = edgeOrientation === "vertical" ? otherEdge.from.y : edge.from.y;
|
|
3608
3625
|
const crossingSegmentLength = 0.1;
|
|
3626
|
+
const lastDrawnPoint = edge.from;
|
|
3609
3627
|
const crossingPoint = { x: intersectX, y: intersectY };
|
|
3628
|
+
const crossingUnitVec = getUnitVectorFromPointAToB(
|
|
3629
|
+
lastDrawnPoint,
|
|
3630
|
+
crossingPoint
|
|
3631
|
+
);
|
|
3610
3632
|
const beforeCrossing = {
|
|
3611
|
-
x:
|
|
3612
|
-
y:
|
|
3633
|
+
x: crossingPoint.x - crossingUnitVec.x * crossingSegmentLength / 2,
|
|
3634
|
+
y: crossingPoint.y - crossingUnitVec.y * crossingSegmentLength / 2
|
|
3613
3635
|
};
|
|
3614
3636
|
const afterCrossing = {
|
|
3615
|
-
x:
|
|
3616
|
-
y:
|
|
3637
|
+
x: crossingPoint.x + crossingUnitVec.x * crossingSegmentLength / 2,
|
|
3638
|
+
y: crossingPoint.y + crossingUnitVec.y * crossingSegmentLength / 2
|
|
3617
3639
|
};
|
|
3618
3640
|
const newEdges = [
|
|
3619
3641
|
{ from: edge.from, to: beforeCrossing },
|
|
@@ -4191,6 +4213,16 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
4191
4213
|
edges.push(
|
|
4192
4214
|
...getStubEdges({ lastEdge, lastEdgePort, lastDominantDirection })
|
|
4193
4215
|
);
|
|
4216
|
+
const firstEdge = edges[0];
|
|
4217
|
+
const firstEdgePort = portsWithPosition[0];
|
|
4218
|
+
const firstDominantDirection = getDominantDirection(firstEdge);
|
|
4219
|
+
edges.unshift(
|
|
4220
|
+
...getStubEdges({
|
|
4221
|
+
firstEdge,
|
|
4222
|
+
firstEdgePort,
|
|
4223
|
+
firstDominantDirection
|
|
4224
|
+
})
|
|
4225
|
+
);
|
|
4194
4226
|
const trace = db.schematic_trace.insert({
|
|
4195
4227
|
source_trace_id: this.source_trace_id,
|
|
4196
4228
|
edges,
|
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.170",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@lume/kiwi": "^0.4.3",
|
|
40
40
|
"@tscircuit/footprinter": "^0.0.77",
|
|
41
41
|
"@tscircuit/infgrid-ijump-astar": "^0.0.24",
|
|
42
|
-
"@tscircuit/math-utils": "^0.0.
|
|
42
|
+
"@tscircuit/math-utils": "^0.0.5",
|
|
43
43
|
"@tscircuit/props": "^0.0.93",
|
|
44
44
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
45
45
|
"@tscircuit/soup-util": "^0.0.40",
|