circuit-to-svg 0.0.159 → 0.0.160
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 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3622,6 +3622,18 @@ var createSvgSchErrorText = ({
|
|
|
3622
3622
|
};
|
|
3623
3623
|
};
|
|
3624
3624
|
|
|
3625
|
+
// lib/utils/is-source-port-connected.ts
|
|
3626
|
+
var isSourcePortConnected = (circuitJson, sourcePortId) => {
|
|
3627
|
+
for (const elm of circuitJson) {
|
|
3628
|
+
if (elm.type !== "source_trace") continue;
|
|
3629
|
+
const trace = elm;
|
|
3630
|
+
if (Array.isArray(trace.connected_source_port_ids) && trace.connected_source_port_ids.includes(sourcePortId)) {
|
|
3631
|
+
return true;
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
return false;
|
|
3635
|
+
};
|
|
3636
|
+
|
|
3625
3637
|
// lib/sch/svg-object-fns/create-svg-objects-from-sch-component-with-symbol.ts
|
|
3626
3638
|
var ninePointAnchorToTextAnchor2 = {
|
|
3627
3639
|
top_left: "start",
|
|
@@ -3681,6 +3693,12 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
3681
3693
|
const texts = symbol.primitives.filter((p) => p.type === "text");
|
|
3682
3694
|
const circles = symbol.primitives.filter((p) => p.type === "circle");
|
|
3683
3695
|
const boxes = symbol.primitives.filter((p) => p.type === "box");
|
|
3696
|
+
const connectedSymbolPorts = /* @__PURE__ */ new Set();
|
|
3697
|
+
for (const match of schPortsWithSymbolPorts) {
|
|
3698
|
+
if (isSourcePortConnected(circuitJson, match.schPort.source_port_id)) {
|
|
3699
|
+
connectedSymbolPorts.add(match.symbolPort);
|
|
3700
|
+
}
|
|
3701
|
+
}
|
|
3684
3702
|
const bounds = {
|
|
3685
3703
|
minX: Math.min(...paths.flatMap((p) => p.points.map((pt) => pt.x))),
|
|
3686
3704
|
maxX: Math.max(...paths.flatMap((p) => p.points.map((pt) => pt.x))),
|
|
@@ -3805,6 +3823,7 @@ var createSvgObjectsFromSchematicComponentWithSymbol = ({
|
|
|
3805
3823
|
});
|
|
3806
3824
|
}
|
|
3807
3825
|
for (const port of symbol.ports) {
|
|
3826
|
+
if (connectedSymbolPorts.has(port)) continue;
|
|
3808
3827
|
const screenPortPos = applyToPoint26(
|
|
3809
3828
|
compose7(realToScreenTransform, transformFromSymbolToReal),
|
|
3810
3829
|
port
|
|
@@ -3921,19 +3940,22 @@ var createSvgObjectsForSchPortBoxLine = ({
|
|
|
3921
3940
|
value: "",
|
|
3922
3941
|
children: []
|
|
3923
3942
|
});
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3943
|
+
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
3944
|
+
if (!isConnected) {
|
|
3945
|
+
svgObjects.push({
|
|
3946
|
+
name: "circle",
|
|
3947
|
+
type: "element",
|
|
3948
|
+
attributes: {
|
|
3949
|
+
class: "component-pin",
|
|
3950
|
+
cx: screenSchPortPos.x.toString(),
|
|
3951
|
+
cy: screenSchPortPos.y.toString(),
|
|
3952
|
+
r: (Math.abs(transform.a) * PIN_CIRCLE_RADIUS_MM).toString(),
|
|
3953
|
+
"stroke-width": `${getSchStrokeSize(transform)}px`
|
|
3954
|
+
},
|
|
3955
|
+
value: "",
|
|
3956
|
+
children: []
|
|
3957
|
+
});
|
|
3958
|
+
}
|
|
3937
3959
|
return svgObjects;
|
|
3938
3960
|
};
|
|
3939
3961
|
|