circuit-to-svg 0.0.112 → 0.0.114

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 CHANGED
@@ -333,6 +333,55 @@ function createSvgObjectsFromPcbPlatedHole(hole, transform) {
333
333
  }
334
334
  ];
335
335
  }
336
+ if (hole.shape === "pill_hole_with_rect_pad") {
337
+ const scaledRectPadWidth = hole.rect_pad_width * Math.abs(transform.a);
338
+ const scaledRectPadHeight = hole.rect_pad_height * Math.abs(transform.a);
339
+ const scaledHoleHeight = hole.hole_height * Math.abs(transform.a);
340
+ const scaledHoleWidth = hole.hole_width * Math.abs(transform.a);
341
+ const holeRadius = Math.min(scaledHoleHeight, scaledHoleWidth) / 2;
342
+ return [
343
+ {
344
+ name: "g",
345
+ type: "element",
346
+ children: [
347
+ // Rectangular pad (outer shape)
348
+ {
349
+ name: "rect",
350
+ type: "element",
351
+ attributes: {
352
+ class: "pcb-hole-outer-pad",
353
+ fill: "rgb(200, 52, 52)",
354
+ x: (x - scaledRectPadWidth / 2).toString(),
355
+ y: (y - scaledRectPadHeight / 2).toString(),
356
+ width: scaledRectPadWidth.toString(),
357
+ height: scaledRectPadHeight.toString()
358
+ },
359
+ value: "",
360
+ children: []
361
+ },
362
+ // pill hole inside the rectangle
363
+ {
364
+ name: "rect",
365
+ type: "element",
366
+ attributes: {
367
+ class: "pcb-hole-inner",
368
+ fill: "rgb(255, 38, 226)",
369
+ x: (x - scaledHoleWidth / 2).toString(),
370
+ y: (y - scaledHoleHeight / 2).toString(),
371
+ width: scaledHoleWidth.toString(),
372
+ height: scaledHoleHeight.toString(),
373
+ rx: holeRadius.toString(),
374
+ ry: holeRadius.toString()
375
+ },
376
+ value: "",
377
+ children: []
378
+ }
379
+ ],
380
+ value: "",
381
+ attributes: {}
382
+ }
383
+ ];
384
+ }
336
385
  return [];
337
386
  }
338
387
 
@@ -368,6 +417,8 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, transform) {
368
417
  fill: "none",
369
418
  stroke: color,
370
419
  "stroke-width": (silkscreenPath.stroke_width * Math.abs(transform.a)).toString(),
420
+ "stroke-linecap": "round",
421
+ "stroke-linejoin": "round",
371
422
  "data-pcb-component-id": silkscreenPath.pcb_component_id,
372
423
  "data-pcb-silkscreen-path-id": silkscreenPath.pcb_silkscreen_path_id
373
424
  },
@@ -392,8 +443,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
392
443
  text,
393
444
  font_size = 1,
394
445
  layer = "top",
395
- ccw_rotation = 0,
396
- stroke_width = 0
446
+ ccw_rotation = 0
397
447
  } = pcbSilkscreenText;
398
448
  if (!anchor_position || typeof anchor_position.x !== "number" || typeof anchor_position.y !== "number") {
399
449
  console.error("Invalid anchor_position:", anchor_position);
@@ -404,7 +454,6 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
404
454
  anchor_position.y
405
455
  ]);
406
456
  const transformedFontSize = font_size * Math.abs(transform.a);
407
- const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
408
457
  const textTransform = compose2(
409
458
  translate2(transformedX, transformedY),
410
459
  rotate2(ccw_rotation * Math.PI / 180),
@@ -425,8 +474,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
425
474
  transform: matrixToString2(textTransform),
426
475
  class: `pcb-silkscreen-text pcb-silkscreen-${layer}`,
427
476
  "data-pcb-silkscreen-text-id": pcbSilkscreenText.pcb_component_id,
428
- stroke: color,
429
- "stroke-width": transformedStrokeWidth.toString()
477
+ stroke: color
430
478
  },
431
479
  children: [
432
480
  {