@tscircuit/core 0.0.259 → 0.0.261
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 +37 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4178,14 +4178,9 @@ var getOtherSchematicTraces = ({
|
|
|
4178
4178
|
import { getUnitVectorFromPointAToB } from "@tscircuit/math-utils";
|
|
4179
4179
|
var createSchematicTraceCrossingSegments = ({
|
|
4180
4180
|
edges,
|
|
4181
|
-
|
|
4182
|
-
source_trace_id
|
|
4181
|
+
otherEdges
|
|
4183
4182
|
}) => {
|
|
4184
|
-
|
|
4185
|
-
db,
|
|
4186
|
-
source_trace_id,
|
|
4187
|
-
differentNetOnly: true
|
|
4188
|
-
}).flatMap((t) => t.edges);
|
|
4183
|
+
edges = [...edges];
|
|
4189
4184
|
for (let i = 0; i < edges.length; i++) {
|
|
4190
4185
|
if (i > 2e3) {
|
|
4191
4186
|
throw new Error(
|
|
@@ -4223,6 +4218,9 @@ var createSchematicTraceCrossingSegments = ({
|
|
|
4223
4218
|
}
|
|
4224
4219
|
const crossingPoint = closestIntersection.crossingPoint;
|
|
4225
4220
|
const crossingSegmentLength = 0.075;
|
|
4221
|
+
if (crossingPoint.x === edge.from.x && crossingPoint.y === edge.from.y) {
|
|
4222
|
+
continue;
|
|
4223
|
+
}
|
|
4226
4224
|
const crossingUnitVec = getUnitVectorFromPointAToB(edge.from, crossingPoint);
|
|
4227
4225
|
const beforeCrossing = {
|
|
4228
4226
|
x: crossingPoint.x - crossingUnitVec.x * crossingSegmentLength / 2,
|
|
@@ -4244,6 +4242,7 @@ var createSchematicTraceCrossingSegments = ({
|
|
|
4244
4242
|
i++;
|
|
4245
4243
|
}
|
|
4246
4244
|
}
|
|
4245
|
+
return edges;
|
|
4247
4246
|
};
|
|
4248
4247
|
|
|
4249
4248
|
// lib/components/primitive-components/Trace/create-schematic-trace-junctions.ts
|
|
@@ -5034,12 +5033,13 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
5034
5033
|
const isFirstPortSchematicBox = firstPort.parent?.config.shouldRenderAsSchematicBox;
|
|
5035
5034
|
const pinFullName = isFirstPortSchematicBox ? `${firstPort?.parent?.props.name}_${firstPort?.props.name}` : `${secondPort?.parent?.props.name}_${secondPort?.props.name}`;
|
|
5036
5035
|
const netLabelText = this.props.schDisplayLabel ?? pinFullName;
|
|
5037
|
-
if (existingFromNetLabel && existingFromNetLabel.text !== netLabelText
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5036
|
+
if (existingFromNetLabel && existingFromNetLabel.text !== netLabelText) {
|
|
5037
|
+
existingFromNetLabel.text = `${netLabelText} / ${existingFromNetLabel.text}`;
|
|
5038
|
+
}
|
|
5039
|
+
if (existingToNetLabel && existingToNetLabel?.text !== netLabelText) {
|
|
5040
|
+
existingToNetLabel.text = `${netLabelText} / ${existingToNetLabel.text}`;
|
|
5041
5041
|
}
|
|
5042
|
-
if (netLabelText?.toLocaleLowerCase().includes("gnd") || netLabelText?.toLocaleLowerCase().includes("ground")) {
|
|
5042
|
+
if (!existingFromNetLabel && !existingToNetLabel && (netLabelText?.toLocaleLowerCase().includes("gnd") || netLabelText?.toLocaleLowerCase().includes("ground"))) {
|
|
5043
5043
|
createDownwardNetLabelGroundSymbol(
|
|
5044
5044
|
{
|
|
5045
5045
|
fromPort,
|
|
@@ -5053,20 +5053,24 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
5053
5053
|
);
|
|
5054
5054
|
return;
|
|
5055
5055
|
}
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5056
|
+
if (!existingToNetLabel) {
|
|
5057
|
+
db.schematic_net_label.insert({
|
|
5058
|
+
text: this.props.schDisplayLabel ?? pinFullName,
|
|
5059
|
+
source_net_id: toPort.source_port_id,
|
|
5060
|
+
anchor_position: toAnchorPos,
|
|
5061
|
+
center: toAnchorPos,
|
|
5062
|
+
anchor_side: getEnteringEdgeFromDirection(toPort.facingDirection) ?? "bottom"
|
|
5063
|
+
});
|
|
5064
|
+
}
|
|
5065
|
+
if (!existingFromNetLabel) {
|
|
5066
|
+
db.schematic_net_label.insert({
|
|
5067
|
+
text: this.props.schDisplayLabel ?? pinFullName,
|
|
5068
|
+
source_net_id: fromPort.source_port_id,
|
|
5069
|
+
anchor_position: fromAnchorPos,
|
|
5070
|
+
center: fromAnchorPos,
|
|
5071
|
+
anchor_side: getEnteringEdgeFromDirection(fromPort.facingDirection) ?? "bottom"
|
|
5072
|
+
});
|
|
5073
|
+
}
|
|
5070
5074
|
}
|
|
5071
5075
|
_isSymbolToChipConnection() {
|
|
5072
5076
|
const { allPortsFound, ports } = this._findConnectedPorts();
|
|
@@ -5192,7 +5196,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
5192
5196
|
skipOtherTraceInteraction = true;
|
|
5193
5197
|
}
|
|
5194
5198
|
const [{ route }] = results;
|
|
5195
|
-
|
|
5199
|
+
let edges = [];
|
|
5196
5200
|
for (let i = 0; i < route.length - 1; i++) {
|
|
5197
5201
|
edges.push({
|
|
5198
5202
|
from: route[i],
|
|
@@ -5203,7 +5207,12 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
5203
5207
|
let junctions = [];
|
|
5204
5208
|
if (!skipOtherTraceInteraction) {
|
|
5205
5209
|
pushEdgesOfSchematicTraceToPreventOverlap({ edges, db, source_trace_id });
|
|
5206
|
-
|
|
5210
|
+
const otherEdges = getOtherSchematicTraces({
|
|
5211
|
+
db,
|
|
5212
|
+
source_trace_id,
|
|
5213
|
+
differentNetOnly: true
|
|
5214
|
+
}).flatMap((t) => t.edges);
|
|
5215
|
+
edges = createSchematicTraceCrossingSegments({ edges, otherEdges });
|
|
5207
5216
|
junctions = createSchematicTraceJunctions({
|
|
5208
5217
|
edges,
|
|
5209
5218
|
db,
|