circuit-to-svg 0.0.273 → 0.0.275

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
@@ -1583,8 +1583,9 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
1583
1583
  const { transform, colorMap: colorMap2, showSolderMask } = ctx;
1584
1584
  const [x, y] = applyToPoint12(transform, [hole.x, hole.y]);
1585
1585
  const copperLayer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
1586
+ const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
1586
1587
  const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
1587
- const shouldShowSolderMask = showSolderMask && soldermaskMargin !== 0;
1588
+ const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
1588
1589
  const solderMaskColor = colorMap2.soldermask.top;
1589
1590
  if (hole.shape === "pill") {
1590
1591
  const scaledOuterWidth = hole.outer_width * Math.abs(transform.a);
@@ -3068,8 +3069,9 @@ import { applyToPoint as applyToPoint24 } from "transformation-matrix";
3068
3069
  function createSvgObjectsFromPcbHole(hole, ctx) {
3069
3070
  const { transform, colorMap: colorMap2, showSolderMask } = ctx;
3070
3071
  const [x, y] = applyToPoint24(transform, [hole.x, hole.y]);
3072
+ const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
3071
3073
  const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform.a);
3072
- const shouldShowSolderMask = showSolderMask && soldermaskMargin !== 0;
3074
+ const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
3073
3075
  const solderMaskColor = colorMap2.soldermask.top;
3074
3076
  if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
3075
3077
  const scaledDiameter = hole.hole_diameter * Math.abs(transform.a);
@@ -3490,23 +3492,34 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
3490
3492
  const scaledWidth = rectCutout.width * Math.abs(transform.a);
3491
3493
  const scaledHeight = rectCutout.height * Math.abs(transform.d);
3492
3494
  const svgRotation = -(rectCutout.rotation ?? 0);
3495
+ const { corner_radius } = rectCutout;
3496
+ const baseCornerRadius = typeof corner_radius === "number" && corner_radius > 0 ? corner_radius : 0;
3497
+ const transformedCornerRadiusX = baseCornerRadius * Math.abs(transform.a);
3498
+ const transformedCornerRadiusY = baseCornerRadius * Math.abs(transform.d);
3499
+ const attributes = {
3500
+ class: "pcb-cutout pcb-cutout-rect",
3501
+ x: (-scaledWidth / 2).toString(),
3502
+ y: (-scaledHeight / 2).toString(),
3503
+ width: scaledWidth.toString(),
3504
+ height: scaledHeight.toString(),
3505
+ fill: colorMap2.drill,
3506
+ transform: matrixToString6(
3507
+ compose3(translate3(cx, cy), rotate3(svgRotation * Math.PI / 180))
3508
+ ),
3509
+ "data-type": "pcb_cutout",
3510
+ "data-pcb-layer": "drill"
3511
+ };
3512
+ if (transformedCornerRadiusX > 0) {
3513
+ attributes.rx = transformedCornerRadiusX.toString();
3514
+ }
3515
+ if (transformedCornerRadiusY > 0) {
3516
+ attributes.ry = transformedCornerRadiusY.toString();
3517
+ }
3493
3518
  return [
3494
3519
  {
3495
3520
  name: "rect",
3496
3521
  type: "element",
3497
- attributes: {
3498
- class: "pcb-cutout pcb-cutout-rect",
3499
- x: (-scaledWidth / 2).toString(),
3500
- y: (-scaledHeight / 2).toString(),
3501
- width: scaledWidth.toString(),
3502
- height: scaledHeight.toString(),
3503
- fill: colorMap2.drill,
3504
- transform: matrixToString6(
3505
- compose3(translate3(cx, cy), rotate3(svgRotation * Math.PI / 180))
3506
- ),
3507
- "data-type": "pcb_cutout",
3508
- "data-pcb-layer": "drill"
3509
- },
3522
+ attributes,
3510
3523
  children: [],
3511
3524
  value: ""
3512
3525
  }
@@ -4279,7 +4292,7 @@ function getSoftwareUsedString(circuitJson) {
4279
4292
  var package_default = {
4280
4293
  name: "circuit-to-svg",
4281
4294
  type: "module",
4282
- version: "0.0.272",
4295
+ version: "0.0.274",
4283
4296
  description: "Convert Circuit JSON to SVG",
4284
4297
  main: "dist/index.js",
4285
4298
  files: [
@@ -4303,7 +4316,7 @@ var package_default = {
4303
4316
  "bun-match-svg": "^0.0.12",
4304
4317
  esbuild: "^0.20.2",
4305
4318
  "performance-now": "^2.1.0",
4306
- "circuit-json": "^0.0.316",
4319
+ "circuit-json": "^0.0.319",
4307
4320
  react: "19.1.0",
4308
4321
  "react-cosmos": "7.0.0",
4309
4322
  "react-cosmos-plugin-vite": "7.0.0",