circuit-to-svg 0.0.190 → 0.0.192
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 +42 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -429,6 +429,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
429
429
|
const scaledHoleDiameter = hole.hole_diameter * Math.abs(transform.a);
|
|
430
430
|
const scaledRectPadWidth = hole.rect_pad_width * Math.abs(transform.a);
|
|
431
431
|
const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
|
|
432
|
+
const scaledRectBorderRadius = (hole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
432
433
|
const holeRadius = scaledHoleDiameter / 2;
|
|
433
434
|
const [holeCx, holeCy] = applyToPoint4(transform, [
|
|
434
435
|
h.x + (h.hole_offset_x ?? 0),
|
|
@@ -449,7 +450,11 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
449
450
|
x: (x - scaledRectPadWidth / 2).toString(),
|
|
450
451
|
y: (y - scaledRectPadHeight / 2).toString(),
|
|
451
452
|
width: scaledRectPadWidth.toString(),
|
|
452
|
-
height: scaledRectPadHeight.toString()
|
|
453
|
+
height: scaledRectPadHeight.toString(),
|
|
454
|
+
...scaledRectBorderRadius ? {
|
|
455
|
+
rx: scaledRectBorderRadius.toString(),
|
|
456
|
+
ry: scaledRectBorderRadius.toString()
|
|
457
|
+
} : {}
|
|
453
458
|
},
|
|
454
459
|
value: "",
|
|
455
460
|
children: []
|
|
@@ -477,6 +482,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
477
482
|
if (hole.shape === "pill_hole_with_rect_pad") {
|
|
478
483
|
const scaledRectPadWidth = hole.rect_pad_width * Math.abs(transform.a);
|
|
479
484
|
const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
|
|
485
|
+
const scaledRectBorderRadius = (hole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
480
486
|
const scaledHoleHeight = hole.hole_height * Math.abs(transform.a);
|
|
481
487
|
const scaledHoleWidth = hole.hole_width * Math.abs(transform.a);
|
|
482
488
|
const holeRadius = Math.min(scaledHoleHeight, scaledHoleWidth) / 2;
|
|
@@ -495,7 +501,11 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
495
501
|
x: (x - scaledRectPadWidth / 2).toString(),
|
|
496
502
|
y: (y - scaledRectPadHeight / 2).toString(),
|
|
497
503
|
width: scaledRectPadWidth.toString(),
|
|
498
|
-
height: scaledRectPadHeight.toString()
|
|
504
|
+
height: scaledRectPadHeight.toString(),
|
|
505
|
+
...scaledRectBorderRadius ? {
|
|
506
|
+
rx: scaledRectBorderRadius.toString(),
|
|
507
|
+
ry: scaledRectBorderRadius.toString()
|
|
508
|
+
} : {}
|
|
499
509
|
},
|
|
500
510
|
value: "",
|
|
501
511
|
children: []
|
|
@@ -526,6 +536,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
526
536
|
if (hole.shape === "rotated_pill_hole_with_rect_pad") {
|
|
527
537
|
const scaledRectPadWidth = hole.rect_pad_width * Math.abs(transform.a);
|
|
528
538
|
const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
|
|
539
|
+
const scaledRectBorderRadius = (hole.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
529
540
|
const scaledHoleHeight = hole.hole_height * Math.abs(transform.a);
|
|
530
541
|
const scaledHoleWidth = hole.hole_width * Math.abs(transform.a);
|
|
531
542
|
const holeRadius = Math.min(scaledHoleHeight, scaledHoleWidth) / 2;
|
|
@@ -544,7 +555,11 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
544
555
|
y: (-scaledRectPadHeight / 2).toString(),
|
|
545
556
|
width: scaledRectPadWidth.toString(),
|
|
546
557
|
height: scaledRectPadHeight.toString(),
|
|
547
|
-
transform: `translate(${x} ${y}) rotate(${-hole.rect_ccw_rotation})
|
|
558
|
+
transform: `translate(${x} ${y}) rotate(${-hole.rect_ccw_rotation})`,
|
|
559
|
+
...scaledRectBorderRadius ? {
|
|
560
|
+
rx: scaledRectBorderRadius.toString(),
|
|
561
|
+
ry: scaledRectBorderRadius.toString()
|
|
562
|
+
} : {}
|
|
548
563
|
},
|
|
549
564
|
value: "",
|
|
550
565
|
children: []
|
|
@@ -999,6 +1014,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
999
1014
|
const width = pad.width * Math.abs(transform.a);
|
|
1000
1015
|
const height = pad.height * Math.abs(transform.d);
|
|
1001
1016
|
const [x, y] = applyToPoint11(transform, [pad.x, pad.y]);
|
|
1017
|
+
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
1002
1018
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
1003
1019
|
return [
|
|
1004
1020
|
{
|
|
@@ -1012,7 +1028,11 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1012
1028
|
width: width.toString(),
|
|
1013
1029
|
height: height.toString(),
|
|
1014
1030
|
transform: `translate(${x} ${y}) rotate(${-pad.ccw_rotation})`,
|
|
1015
|
-
"data-layer": pad.layer
|
|
1031
|
+
"data-layer": pad.layer,
|
|
1032
|
+
...scaledBorderRadius ? {
|
|
1033
|
+
rx: scaledBorderRadius.toString(),
|
|
1034
|
+
ry: scaledBorderRadius.toString()
|
|
1035
|
+
} : {}
|
|
1016
1036
|
}
|
|
1017
1037
|
}
|
|
1018
1038
|
];
|
|
@@ -1028,7 +1048,11 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
1028
1048
|
y: (y - height / 2).toString(),
|
|
1029
1049
|
width: width.toString(),
|
|
1030
1050
|
height: height.toString(),
|
|
1031
|
-
"data-layer": pad.layer
|
|
1051
|
+
"data-layer": pad.layer,
|
|
1052
|
+
...scaledBorderRadius ? {
|
|
1053
|
+
rx: scaledBorderRadius.toString(),
|
|
1054
|
+
ry: scaledBorderRadius.toString()
|
|
1055
|
+
} : {}
|
|
1032
1056
|
}
|
|
1033
1057
|
}
|
|
1034
1058
|
];
|
|
@@ -1479,7 +1503,7 @@ function ringToPathD(vertices, transform) {
|
|
|
1479
1503
|
const dy = end.y - start.y;
|
|
1480
1504
|
const dist = Math.hypot(dx, dy);
|
|
1481
1505
|
const radius = Math.abs(dist / 4 / bulge * (bulge * bulge + 1));
|
|
1482
|
-
const sweepFlag = bulge < 0 ?
|
|
1506
|
+
const sweepFlag = bulge < 0 ? 1 : 0;
|
|
1483
1507
|
const largeArcFlag = Math.abs(bulge) > 1 ? 1 : 0;
|
|
1484
1508
|
d += ` A ${radius} ${radius} 0 ${largeArcFlag} ${sweepFlag} ${end.x} ${end.y}`;
|
|
1485
1509
|
} else {
|
|
@@ -1621,7 +1645,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
1621
1645
|
var package_default = {
|
|
1622
1646
|
name: "circuit-to-svg",
|
|
1623
1647
|
type: "module",
|
|
1624
|
-
version: "0.0.
|
|
1648
|
+
version: "0.0.191",
|
|
1625
1649
|
description: "Convert Circuit JSON to SVG",
|
|
1626
1650
|
main: "dist/index.js",
|
|
1627
1651
|
files: [
|
|
@@ -2619,6 +2643,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
2619
2643
|
const width = pad.width * Math.abs(transform.a);
|
|
2620
2644
|
const height = pad.height * Math.abs(transform.d);
|
|
2621
2645
|
const [x, y] = applyToPoint26(transform, [pad.x, pad.y]);
|
|
2646
|
+
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform.a);
|
|
2622
2647
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
2623
2648
|
return [
|
|
2624
2649
|
{
|
|
@@ -2632,7 +2657,11 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
2632
2657
|
width: width.toString(),
|
|
2633
2658
|
height: height.toString(),
|
|
2634
2659
|
transform: `translate(${x} ${y}) rotate(${-pad.ccw_rotation})`,
|
|
2635
|
-
"data-layer": pad.layer
|
|
2660
|
+
"data-layer": pad.layer,
|
|
2661
|
+
...scaledBorderRadius ? {
|
|
2662
|
+
rx: scaledBorderRadius.toString(),
|
|
2663
|
+
ry: scaledBorderRadius.toString()
|
|
2664
|
+
} : {}
|
|
2636
2665
|
},
|
|
2637
2666
|
value: "",
|
|
2638
2667
|
children: []
|
|
@@ -2650,7 +2679,11 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
2650
2679
|
y: (y - height / 2).toString(),
|
|
2651
2680
|
width: width.toString(),
|
|
2652
2681
|
height: height.toString(),
|
|
2653
|
-
"data-layer": pad.layer
|
|
2682
|
+
"data-layer": pad.layer,
|
|
2683
|
+
...scaledBorderRadius ? {
|
|
2684
|
+
rx: scaledBorderRadius.toString(),
|
|
2685
|
+
ry: scaledBorderRadius.toString()
|
|
2686
|
+
} : {}
|
|
2654
2687
|
},
|
|
2655
2688
|
value: "",
|
|
2656
2689
|
children: []
|