@tscircuit/core 0.0.488 → 0.0.489
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 +35 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5192,10 +5192,35 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
5192
5192
|
facingDirection: port.facingDirection
|
|
5193
5193
|
}));
|
|
5194
5194
|
const isPortAndNetConnection = portsWithPosition.length === 1 && netsWithSelectors.length === 1;
|
|
5195
|
-
if (
|
|
5196
|
-
|
|
5197
|
-
|
|
5198
|
-
|
|
5195
|
+
if (isPortAndNetConnection) {
|
|
5196
|
+
const net = netsWithSelectors[0].net;
|
|
5197
|
+
const { port, position: anchorPos } = portsWithPosition[0];
|
|
5198
|
+
const connectedNetLabel = this.getSubcircuit().selectAll("netlabel").find((nl) => {
|
|
5199
|
+
const conn = nl._parsedProps.connection ?? nl._parsedProps.connectsTo;
|
|
5200
|
+
if (!conn) return false;
|
|
5201
|
+
const targetPort = this.getSubcircuit().selectOne(conn, {
|
|
5202
|
+
port: true
|
|
5203
|
+
});
|
|
5204
|
+
return targetPort === port;
|
|
5205
|
+
});
|
|
5206
|
+
if (connectedNetLabel) {
|
|
5207
|
+
const labelPos = connectedNetLabel._getGlobalSchematicPositionBeforeLayout();
|
|
5208
|
+
const edges2 = [];
|
|
5209
|
+
if (anchorPos.x === labelPos.x || anchorPos.y === labelPos.y) {
|
|
5210
|
+
edges2.push({ from: anchorPos, to: labelPos });
|
|
5211
|
+
} else {
|
|
5212
|
+
edges2.push({ from: anchorPos, to: { x: labelPos.x, y: anchorPos.y } });
|
|
5213
|
+
edges2.push({ from: { x: labelPos.x, y: anchorPos.y }, to: labelPos });
|
|
5214
|
+
}
|
|
5215
|
+
const trace2 = db.schematic_trace.insert({
|
|
5216
|
+
source_trace_id: this.source_trace_id,
|
|
5217
|
+
edges: edges2,
|
|
5218
|
+
junctions: []
|
|
5219
|
+
});
|
|
5220
|
+
this.schematic_trace_id = trace2.schematic_trace_id;
|
|
5221
|
+
return;
|
|
5222
|
+
}
|
|
5223
|
+
if (this.props.schDisplayLabel) {
|
|
5199
5224
|
db.schematic_net_label.insert({
|
|
5200
5225
|
text: this.props.schDisplayLabel,
|
|
5201
5226
|
source_net_id: net.source_net_id,
|
|
@@ -5204,14 +5229,7 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
5204
5229
|
anchor_side: getEnteringEdgeFromDirection(port.facingDirection) ?? "bottom"
|
|
5205
5230
|
});
|
|
5206
5231
|
return;
|
|
5207
|
-
} else if ("from" in this.props && "to" in this.props || "path" in this.props) {
|
|
5208
|
-
this._doInitialSchematicTraceRenderWithDisplayLabel();
|
|
5209
|
-
return;
|
|
5210
5232
|
}
|
|
5211
|
-
}
|
|
5212
|
-
if (isPortAndNetConnection) {
|
|
5213
|
-
const net = netsWithSelectors[0].net;
|
|
5214
|
-
const { port, position: anchorPos } = portsWithPosition[0];
|
|
5215
5233
|
const netLabel = db.schematic_net_label.insert({
|
|
5216
5234
|
text: net._parsedProps.name,
|
|
5217
5235
|
source_net_id: net.source_net_id,
|
|
@@ -5222,6 +5240,12 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
|
|
|
5222
5240
|
});
|
|
5223
5241
|
return;
|
|
5224
5242
|
}
|
|
5243
|
+
if (this.props.schDisplayLabel) {
|
|
5244
|
+
if ("from" in this.props && "to" in this.props || "path" in this.props) {
|
|
5245
|
+
this._doInitialSchematicTraceRenderWithDisplayLabel();
|
|
5246
|
+
return;
|
|
5247
|
+
}
|
|
5248
|
+
}
|
|
5225
5249
|
if (portsWithPosition.length < 2) {
|
|
5226
5250
|
return;
|
|
5227
5251
|
}
|