circuit-to-svg 0.0.112 → 0.0.113

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
 
@@ -392,8 +441,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
392
441
  text,
393
442
  font_size = 1,
394
443
  layer = "top",
395
- ccw_rotation = 0,
396
- stroke_width = 0
444
+ ccw_rotation = 0
397
445
  } = pcbSilkscreenText;
398
446
  if (!anchor_position || typeof anchor_position.x !== "number" || typeof anchor_position.y !== "number") {
399
447
  console.error("Invalid anchor_position:", anchor_position);
@@ -404,7 +452,6 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
404
452
  anchor_position.y
405
453
  ]);
406
454
  const transformedFontSize = font_size * Math.abs(transform.a);
407
- const transformedStrokeWidth = stroke_width * Math.abs(transform.a);
408
455
  const textTransform = compose2(
409
456
  translate2(transformedX, transformedY),
410
457
  rotate2(ccw_rotation * Math.PI / 180),
@@ -425,8 +472,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, transform) {
425
472
  transform: matrixToString2(textTransform),
426
473
  class: `pcb-silkscreen-text pcb-silkscreen-${layer}`,
427
474
  "data-pcb-silkscreen-text-id": pcbSilkscreenText.pcb_component_id,
428
- stroke: color,
429
- "stroke-width": transformedStrokeWidth.toString()
475
+ stroke: color
430
476
  },
431
477
  children: [
432
478
  {