circuit-to-svg 0.0.106 → 0.0.108
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 +11 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -307,6 +307,8 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, transform) {
|
|
|
307
307
|
attributes: {
|
|
308
308
|
class: `pcb-silkscreen pcb-silkscreen-${silkscreenPath.layer}`,
|
|
309
309
|
d: path,
|
|
310
|
+
fill: "none",
|
|
311
|
+
stroke: "#f2eda1",
|
|
310
312
|
"stroke-width": (silkscreenPath.stroke_width * Math.abs(transform.a)).toString(),
|
|
311
313
|
"data-pcb-component-id": silkscreenPath.pcb_component_id,
|
|
312
314
|
"data-pcb-silkscreen-path-id": silkscreenPath.pcb_silkscreen_path_id
|
|
@@ -330,7 +332,8 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
|
|
|
330
332
|
anchor_position,
|
|
331
333
|
text,
|
|
332
334
|
font_size = 1,
|
|
333
|
-
layer = "top"
|
|
335
|
+
layer = "top",
|
|
336
|
+
ccw_rotation = 0
|
|
334
337
|
} = pcbSilkscreenText;
|
|
335
338
|
if (!anchor_position || typeof anchor_position.x !== "number" || typeof anchor_position.y !== "number") {
|
|
336
339
|
console.error("Invalid anchor_position:", anchor_position);
|
|
@@ -343,7 +346,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
|
|
|
343
346
|
const transformedFontSize = font_size * Math.abs(transform.a);
|
|
344
347
|
const textTransform = compose2(
|
|
345
348
|
translate2(transformedX, transformedY),
|
|
346
|
-
rotate2(Math.PI / 180)
|
|
349
|
+
rotate2(ccw_rotation * Math.PI / 180)
|
|
347
350
|
// Convert degrees to radians
|
|
348
351
|
);
|
|
349
352
|
const svgObject = {
|
|
@@ -352,6 +355,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
|
|
|
352
355
|
attributes: {
|
|
353
356
|
x: "0",
|
|
354
357
|
y: "0",
|
|
358
|
+
fill: "#f2eda1",
|
|
355
359
|
"font-family": "Arial, sans-serif",
|
|
356
360
|
"font-size": transformedFontSize.toString(),
|
|
357
361
|
"text-anchor": "middle",
|
|
@@ -405,7 +409,8 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, transform) {
|
|
|
405
409
|
width: transformedWidth.toString(),
|
|
406
410
|
height: transformedHeight.toString(),
|
|
407
411
|
class: `pcb-silkscreen-rect pcb-silkscreen-${layer}`,
|
|
408
|
-
|
|
412
|
+
fill: "none",
|
|
413
|
+
stroke: "#f2eda1",
|
|
409
414
|
"stroke-width": "1",
|
|
410
415
|
"data-pcb-silkscreen-rect-id": pcb_silkscreen_rect_id
|
|
411
416
|
},
|
|
@@ -435,9 +440,6 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, transform)
|
|
|
435
440
|
center.y
|
|
436
441
|
]);
|
|
437
442
|
const transformedRadius = radius * Math.abs(transform.a);
|
|
438
|
-
console.debug(
|
|
439
|
-
`Transformed Circle - X: ${transformedX}, Y: ${transformedY}, Radius: ${transformedRadius}`
|
|
440
|
-
);
|
|
441
443
|
const svgObject = {
|
|
442
444
|
name: "circle",
|
|
443
445
|
type: "element",
|
|
@@ -446,14 +448,13 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, transform)
|
|
|
446
448
|
cy: transformedY.toString(),
|
|
447
449
|
r: transformedRadius.toString(),
|
|
448
450
|
class: `pcb-silkscreen-circle pcb-silkscreen-${layer}`,
|
|
449
|
-
stroke: "
|
|
450
|
-
"stroke-width": "
|
|
451
|
+
stroke: "#f2eda1",
|
|
452
|
+
"stroke-width": "1",
|
|
451
453
|
"data-pcb-silkscreen-circle-id": pcb_silkscreen_circle_id
|
|
452
454
|
},
|
|
453
455
|
value: "",
|
|
454
456
|
children: []
|
|
455
457
|
};
|
|
456
|
-
console.log(svgObject);
|
|
457
458
|
return [svgObject];
|
|
458
459
|
}
|
|
459
460
|
|
|
@@ -487,6 +488,7 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, transform) {
|
|
|
487
488
|
y1: transformedY1.toString(),
|
|
488
489
|
x2: transformedX2.toString(),
|
|
489
490
|
y2: transformedY2.toString(),
|
|
491
|
+
stroke: "#f2eda1",
|
|
490
492
|
"stroke-width": transformedStrokeWidth.toString(),
|
|
491
493
|
class: `pcb-silkscreen-line pcb-silkscreen-${layer}`,
|
|
492
494
|
"data-pcb-silkscreen-line-id": pcb_silkscreen_line_id
|
|
@@ -979,10 +981,6 @@ function convertCircuitJsonToPcbSvg(soup, options) {
|
|
|
979
981
|
.pcb-hole-inner { fill: rgb(255, 38, 226); }
|
|
980
982
|
.pcb-pad { }
|
|
981
983
|
.pcb-boundary { fill: none; stroke: #fff; stroke-width: 0.3; }
|
|
982
|
-
.pcb-silkscreen { fill: none; }
|
|
983
|
-
.pcb-silkscreen-top { stroke: #f2eda1; }
|
|
984
|
-
.pcb-silkscreen-bottom { stroke: #f2eda1; }
|
|
985
|
-
.pcb-silkscreen-text { fill: #f2eda1; }
|
|
986
984
|
`
|
|
987
985
|
}
|
|
988
986
|
]
|