circuit-to-svg 0.0.259 → 0.0.260
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 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -538,7 +538,8 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
538
538
|
color,
|
|
539
539
|
layer = "top",
|
|
540
540
|
pcb_component_id,
|
|
541
|
-
pcb_fabrication_note_rect_id
|
|
541
|
+
pcb_fabrication_note_rect_id,
|
|
542
|
+
corner_radius
|
|
542
543
|
} = fabricationNoteRect;
|
|
543
544
|
if (layerFilter && layer !== layerFilter) return [];
|
|
544
545
|
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
@@ -566,6 +567,9 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
566
567
|
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
567
568
|
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
568
569
|
const overlayStrokeColor = color ?? DEFAULT_OVERLAY_STROKE_COLOR;
|
|
570
|
+
const baseCornerRadius = typeof corner_radius === "number" && corner_radius > 0 ? corner_radius : 0;
|
|
571
|
+
const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
|
|
572
|
+
const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
|
|
569
573
|
const attributes = {
|
|
570
574
|
x: rectX.toString(),
|
|
571
575
|
y: rectY.toString(),
|
|
@@ -579,6 +583,12 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
579
583
|
if (pcb_component_id !== void 0) {
|
|
580
584
|
attributes["data-pcb-component-id"] = pcb_component_id;
|
|
581
585
|
}
|
|
586
|
+
if (transformedCornerRadiusX > 0) {
|
|
587
|
+
attributes.rx = transformedCornerRadiusX.toString();
|
|
588
|
+
}
|
|
589
|
+
if (transformedCornerRadiusY > 0) {
|
|
590
|
+
attributes.ry = transformedCornerRadiusY.toString();
|
|
591
|
+
}
|
|
582
592
|
if (is_filled) {
|
|
583
593
|
attributes.fill = color ?? DEFAULT_OVERLAY_FILL_COLOR;
|
|
584
594
|
} else {
|
|
@@ -1411,7 +1421,8 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
1411
1421
|
is_filled,
|
|
1412
1422
|
has_stroke,
|
|
1413
1423
|
is_stroke_dashed,
|
|
1414
|
-
color
|
|
1424
|
+
color,
|
|
1425
|
+
corner_radius
|
|
1415
1426
|
} = noteRect;
|
|
1416
1427
|
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
1417
1428
|
console.error("Invalid pcb_note_rect data", { center, width, height });
|
|
@@ -1433,6 +1444,9 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
1433
1444
|
const rectHeight = Math.abs(bottomRightY - topLeftY);
|
|
1434
1445
|
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
1435
1446
|
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform.a);
|
|
1447
|
+
const baseCornerRadius = typeof corner_radius === "number" && corner_radius > 0 ? corner_radius : 0;
|
|
1448
|
+
const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
|
|
1449
|
+
const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
|
|
1436
1450
|
const overlayColor = color ?? DEFAULT_OVERLAY_COLOR2;
|
|
1437
1451
|
const attributes = {
|
|
1438
1452
|
x: rectX.toString(),
|
|
@@ -1444,6 +1458,12 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
1444
1458
|
"data-pcb-note-rect-id": noteRect.pcb_note_rect_id,
|
|
1445
1459
|
"data-pcb-layer": "overlay"
|
|
1446
1460
|
};
|
|
1461
|
+
if (transformedCornerRadiusX > 0) {
|
|
1462
|
+
attributes.rx = transformedCornerRadiusX.toString();
|
|
1463
|
+
}
|
|
1464
|
+
if (transformedCornerRadiusY > 0) {
|
|
1465
|
+
attributes.ry = transformedCornerRadiusY.toString();
|
|
1466
|
+
}
|
|
1447
1467
|
if (is_filled) {
|
|
1448
1468
|
attributes.fill = color ?? DEFAULT_FILL_COLOR;
|
|
1449
1469
|
} else {
|
|
@@ -2067,7 +2087,8 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2067
2087
|
stroke_width,
|
|
2068
2088
|
is_filled,
|
|
2069
2089
|
has_stroke,
|
|
2070
|
-
is_stroke_dashed
|
|
2090
|
+
is_stroke_dashed,
|
|
2091
|
+
corner_radius
|
|
2071
2092
|
} = pcbSilkscreenRect;
|
|
2072
2093
|
if (layerFilter && layer !== layerFilter) return [];
|
|
2073
2094
|
if (!center || typeof center.x !== "number" || typeof center.y !== "number" || typeof width !== "number" || typeof height !== "number") {
|
|
@@ -2078,6 +2099,9 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2078
2099
|
center.x,
|
|
2079
2100
|
center.y
|
|
2080
2101
|
]);
|
|
2102
|
+
const baseCornerRadius = typeof corner_radius === "number" && corner_radius > 0 ? corner_radius : 0;
|
|
2103
|
+
const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
|
|
2104
|
+
const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
|
|
2081
2105
|
const transformedWidth = width * Math.abs(transform.a);
|
|
2082
2106
|
const transformedHeight = height * Math.abs(transform.d);
|
|
2083
2107
|
const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
|
|
@@ -2092,6 +2116,12 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
2092
2116
|
"data-type": "pcb_silkscreen_rect",
|
|
2093
2117
|
"data-pcb-layer": layer
|
|
2094
2118
|
};
|
|
2119
|
+
if (transformedCornerRadiusX > 0) {
|
|
2120
|
+
attributes.rx = transformedCornerRadiusX.toString();
|
|
2121
|
+
}
|
|
2122
|
+
if (transformedCornerRadiusY > 0) {
|
|
2123
|
+
attributes.ry = transformedCornerRadiusY.toString();
|
|
2124
|
+
}
|
|
2095
2125
|
attributes.fill = is_filled ? color : "none";
|
|
2096
2126
|
let actualHasStroke;
|
|
2097
2127
|
if (has_stroke === void 0) {
|
|
@@ -3472,7 +3502,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
3472
3502
|
var package_default = {
|
|
3473
3503
|
name: "circuit-to-svg",
|
|
3474
3504
|
type: "module",
|
|
3475
|
-
version: "0.0.
|
|
3505
|
+
version: "0.0.259",
|
|
3476
3506
|
description: "Convert Circuit JSON to SVG",
|
|
3477
3507
|
main: "dist/index.js",
|
|
3478
3508
|
files: [
|
|
@@ -3496,7 +3526,7 @@ var package_default = {
|
|
|
3496
3526
|
"bun-match-svg": "^0.0.12",
|
|
3497
3527
|
esbuild: "^0.20.2",
|
|
3498
3528
|
"performance-now": "^2.1.0",
|
|
3499
|
-
"circuit-json": "^0.0.
|
|
3529
|
+
"circuit-json": "^0.0.297",
|
|
3500
3530
|
react: "19.1.0",
|
|
3501
3531
|
"react-cosmos": "7.0.0",
|
|
3502
3532
|
"react-cosmos-plugin-vite": "7.0.0",
|