@tscircuit/core 0.0.39 → 0.0.40
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 +15 -8
- package/lib/components/primitive-components/Constraint.ts +9 -5
- package/lib/components/primitive-components/PlatedHole.ts +3 -2
- package/lib/components/primitive-components/Port.ts +4 -2
- package/lib/components/primitive-components/SmtPad.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -876,8 +876,10 @@ var Port = class extends PrimitiveComponent {
|
|
|
876
876
|
}
|
|
877
877
|
_setPositionFromLayout(newCenter) {
|
|
878
878
|
const { db } = this.root;
|
|
879
|
-
|
|
880
|
-
|
|
879
|
+
if (!this.pcb_port_id) return;
|
|
880
|
+
db.pcb_port.update(this.pcb_port_id, {
|
|
881
|
+
x: newCenter.x,
|
|
882
|
+
y: newCenter.y
|
|
881
883
|
});
|
|
882
884
|
}
|
|
883
885
|
};
|
|
@@ -1173,6 +1175,7 @@ var SmtPad = class extends PrimitiveComponent {
|
|
|
1173
1175
|
x: newCenter.x,
|
|
1174
1176
|
y: newCenter.y
|
|
1175
1177
|
});
|
|
1178
|
+
this.matchedPort?._setPositionFromLayout(newCenter);
|
|
1176
1179
|
}
|
|
1177
1180
|
};
|
|
1178
1181
|
|
|
@@ -1261,10 +1264,11 @@ var PlatedHole = class extends PrimitiveComponent {
|
|
|
1261
1264
|
x: newCenter.x,
|
|
1262
1265
|
y: newCenter.y
|
|
1263
1266
|
});
|
|
1267
|
+
this.matchedPort?._setPositionFromLayout(newCenter);
|
|
1264
1268
|
}
|
|
1265
1269
|
doInitialPortMatching() {
|
|
1266
|
-
const parentPorts =
|
|
1267
|
-
|
|
1270
|
+
const parentPorts = this.getPrimitiveContainer()?.selectAll(
|
|
1271
|
+
"port"
|
|
1268
1272
|
);
|
|
1269
1273
|
if (!this.props.portHints) {
|
|
1270
1274
|
return;
|
|
@@ -3034,14 +3038,17 @@ var Constraint2 = class extends PrimitiveComponent {
|
|
|
3034
3038
|
const componentsWithSelectors = [];
|
|
3035
3039
|
const container = this.getPrimitiveContainer();
|
|
3036
3040
|
function addComponentFromSelector(selector) {
|
|
3037
|
-
const
|
|
3041
|
+
const maybeEdge = selector.split(" ").pop();
|
|
3042
|
+
const edge = edgeSpecifiers.includes(maybeEdge) ? maybeEdge : void 0;
|
|
3043
|
+
const componentSelector = edge ? selector.replace(` ${edge}`, "") : selector;
|
|
3044
|
+
const component = container.selectOne(componentSelector, {
|
|
3045
|
+
pcbPrimitive: true
|
|
3046
|
+
});
|
|
3038
3047
|
if (component) {
|
|
3039
|
-
const maybeEdge = selector.split(" ").pop();
|
|
3040
|
-
const edge = edgeSpecifiers.includes(maybeEdge) ? maybeEdge : void 0;
|
|
3041
3048
|
componentsWithSelectors.push({
|
|
3042
3049
|
selector,
|
|
3043
3050
|
component,
|
|
3044
|
-
componentSelector
|
|
3051
|
+
componentSelector,
|
|
3045
3052
|
edge
|
|
3046
3053
|
});
|
|
3047
3054
|
}
|
|
@@ -56,15 +56,19 @@ export class Constraint extends PrimitiveComponent<typeof constraintProps> {
|
|
|
56
56
|
function addComponentFromSelector(selector: string) {
|
|
57
57
|
// TODO this selector has to be modified in case it contains a leftedge,
|
|
58
58
|
// center/topedge/rightedge indicator
|
|
59
|
-
const
|
|
59
|
+
const maybeEdge = selector.split(" ").pop() as EdgeSpecifier
|
|
60
|
+
const edge = edgeSpecifiers.includes(maybeEdge) ? maybeEdge : undefined
|
|
61
|
+
const componentSelector = edge
|
|
62
|
+
? selector.replace(` ${edge}`, "")
|
|
63
|
+
: selector
|
|
64
|
+
const component = container.selectOne(componentSelector, {
|
|
65
|
+
pcbPrimitive: true,
|
|
66
|
+
})
|
|
60
67
|
if (component) {
|
|
61
|
-
const maybeEdge = selector.split(" ").pop() as EdgeSpecifier
|
|
62
|
-
const edge = edgeSpecifiers.includes(maybeEdge) ? maybeEdge : undefined
|
|
63
|
-
|
|
64
68
|
componentsWithSelectors.push({
|
|
65
69
|
selector,
|
|
66
70
|
component,
|
|
67
|
-
componentSelector
|
|
71
|
+
componentSelector,
|
|
68
72
|
edge,
|
|
69
73
|
})
|
|
70
74
|
}
|
|
@@ -56,11 +56,12 @@ export class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
|
|
|
56
56
|
x: newCenter.x,
|
|
57
57
|
y: newCenter.y,
|
|
58
58
|
})
|
|
59
|
+
this.matchedPort?._setPositionFromLayout(newCenter)
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
doInitialPortMatching(): void {
|
|
62
|
-
const parentPorts =
|
|
63
|
-
|
|
63
|
+
const parentPorts = this.getPrimitiveContainer()?.selectAll(
|
|
64
|
+
"port",
|
|
64
65
|
) as Port[]
|
|
65
66
|
|
|
66
67
|
if (!this.props.portHints) {
|
|
@@ -208,9 +208,11 @@ export class Port extends PrimitiveComponent<typeof portProps> {
|
|
|
208
208
|
|
|
209
209
|
_setPositionFromLayout(newCenter: { x: number; y: number }): void {
|
|
210
210
|
const { db } = this.root!
|
|
211
|
+
if (!this.pcb_port_id) return
|
|
211
212
|
|
|
212
|
-
db.
|
|
213
|
-
|
|
213
|
+
db.pcb_port.update(this.pcb_port_id!, {
|
|
214
|
+
x: newCenter.x,
|
|
215
|
+
y: newCenter.y,
|
|
214
216
|
})
|
|
215
217
|
}
|
|
216
218
|
}
|