circuit-to-svg 0.0.274 → 0.0.276
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 +64 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1583,8 +1583,9 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
1583
1583
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
1584
1584
|
const [x, y] = applyToPoint12(transform, [hole.x, hole.y]);
|
|
1585
1585
|
const copperLayer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
|
|
1586
|
+
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
1586
1587
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
|
|
1587
|
-
const shouldShowSolderMask = showSolderMask && soldermaskMargin !== 0;
|
|
1588
|
+
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
1588
1589
|
const solderMaskColor = colorMap2.soldermask.top;
|
|
1589
1590
|
if (hole.shape === "pill") {
|
|
1590
1591
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
@@ -1670,6 +1671,64 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
1670
1671
|
}
|
|
1671
1672
|
];
|
|
1672
1673
|
}
|
|
1674
|
+
if (hole.shape === "oval") {
|
|
1675
|
+
const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
|
|
1676
|
+
const scaledOuterHeight = hole.outer_height * Math.abs(transform.a);
|
|
1677
|
+
const scaledHoleWidth = hole.hole_width * Math.abs(transform.a);
|
|
1678
|
+
const scaledHoleHeight = hole.hole_height * Math.abs(transform.a);
|
|
1679
|
+
const rotation = hole.ccw_rotation || 0;
|
|
1680
|
+
const transformStr = rotation ? `translate(${x} ${y}) rotate(${-rotation})` : `translate(${x} ${y})`;
|
|
1681
|
+
const children = [
|
|
1682
|
+
// Outer oval shape
|
|
1683
|
+
{
|
|
1684
|
+
name: "ellipse",
|
|
1685
|
+
type: "element",
|
|
1686
|
+
attributes: {
|
|
1687
|
+
class: "pcb-hole-outer",
|
|
1688
|
+
fill: colorMap2.copper.top,
|
|
1689
|
+
cx: "0",
|
|
1690
|
+
cy: "0",
|
|
1691
|
+
rx: (scaledOuterWidth / 2).toString(),
|
|
1692
|
+
ry: (scaledOuterHeight / 2).toString(),
|
|
1693
|
+
transform: transformStr,
|
|
1694
|
+
"data-type": "pcb_plated_hole",
|
|
1695
|
+
"data-pcb-layer": copperLayer
|
|
1696
|
+
},
|
|
1697
|
+
value: "",
|
|
1698
|
+
children: []
|
|
1699
|
+
},
|
|
1700
|
+
// Inner oval shape
|
|
1701
|
+
{
|
|
1702
|
+
name: "ellipse",
|
|
1703
|
+
type: "element",
|
|
1704
|
+
attributes: {
|
|
1705
|
+
class: "pcb-hole-inner",
|
|
1706
|
+
fill: colorMap2.drill,
|
|
1707
|
+
cx: "0",
|
|
1708
|
+
cy: "0",
|
|
1709
|
+
rx: (scaledHoleWidth / 2).toString(),
|
|
1710
|
+
ry: (scaledHoleHeight / 2).toString(),
|
|
1711
|
+
transform: transformStr,
|
|
1712
|
+
"data-type": "pcb_plated_hole_drill",
|
|
1713
|
+
"data-pcb-layer": "drill"
|
|
1714
|
+
},
|
|
1715
|
+
value: "",
|
|
1716
|
+
children: []
|
|
1717
|
+
}
|
|
1718
|
+
];
|
|
1719
|
+
return [
|
|
1720
|
+
{
|
|
1721
|
+
name: "g",
|
|
1722
|
+
type: "element",
|
|
1723
|
+
attributes: {
|
|
1724
|
+
"data-type": "pcb_plated_hole",
|
|
1725
|
+
"data-pcb-layer": "through"
|
|
1726
|
+
},
|
|
1727
|
+
children,
|
|
1728
|
+
value: ""
|
|
1729
|
+
}
|
|
1730
|
+
];
|
|
1731
|
+
}
|
|
1673
1732
|
if (hole.shape === "circle") {
|
|
1674
1733
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform.a);
|
|
1675
1734
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform.a);
|
|
@@ -3068,8 +3127,9 @@ import { applyToPoint as applyToPoint24 } from "transformation-matrix";
|
|
|
3068
3127
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
3069
3128
|
const { transform, colorMap: colorMap2, showSolderMask } = ctx;
|
|
3070
3129
|
const [x, y] = applyToPoint24(transform, [hole.x, hole.y]);
|
|
3130
|
+
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
3071
3131
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
|
|
3072
|
-
const shouldShowSolderMask = showSolderMask && soldermaskMargin !== 0;
|
|
3132
|
+
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
3073
3133
|
const solderMaskColor = colorMap2.soldermask.top;
|
|
3074
3134
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
3075
3135
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
@@ -4290,7 +4350,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
4290
4350
|
var package_default = {
|
|
4291
4351
|
name: "circuit-to-svg",
|
|
4292
4352
|
type: "module",
|
|
4293
|
-
version: "0.0.
|
|
4353
|
+
version: "0.0.275",
|
|
4294
4354
|
description: "Convert Circuit JSON to SVG",
|
|
4295
4355
|
main: "dist/index.js",
|
|
4296
4356
|
files: [
|
|
@@ -4314,7 +4374,7 @@ var package_default = {
|
|
|
4314
4374
|
"bun-match-svg": "^0.0.12",
|
|
4315
4375
|
esbuild: "^0.20.2",
|
|
4316
4376
|
"performance-now": "^2.1.0",
|
|
4317
|
-
"circuit-json": "^0.0.
|
|
4377
|
+
"circuit-json": "^0.0.319",
|
|
4318
4378
|
react: "19.1.0",
|
|
4319
4379
|
"react-cosmos": "7.0.0",
|
|
4320
4380
|
"react-cosmos-plugin-vite": "7.0.0",
|