circuit-to-svg 0.0.281 → 0.0.282

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
@@ -3196,28 +3196,33 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3196
3196
  };
3197
3197
  return [substrateElement, padElement];
3198
3198
  }
3199
- if (pad.shape === "pill") {
3199
+ if (pad.shape === "pill" || pad.shape === "rotated_pill") {
3200
+ const isRotated = pad.shape === "rotated_pill";
3200
3201
  const width = pad.width * Math.abs(transform.a);
3201
3202
  const height = pad.height * Math.abs(transform.d);
3202
3203
  const radius = pad.radius * Math.abs(transform.a);
3203
3204
  const [x, y] = applyToPoint20(transform, [pad.x, pad.y]);
3205
+ const baseAttributes = {
3206
+ class: "pcb-pad",
3207
+ fill: layerNameToColor(pad.layer, colorMap2),
3208
+ x: isRotated ? (-width / 2).toString() : (x - width / 2).toString(),
3209
+ y: isRotated ? (-height / 2).toString() : (y - height / 2).toString(),
3210
+ width: width.toString(),
3211
+ height: height.toString(),
3212
+ rx: radius.toString(),
3213
+ ry: radius.toString(),
3214
+ "data-type": "pcb_smtpad",
3215
+ "data-pcb-layer": pad.layer,
3216
+ ...isRotated ? {
3217
+ transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
3218
+ } : {}
3219
+ };
3204
3220
  const padElement = {
3205
3221
  name: "rect",
3206
3222
  type: "element",
3207
3223
  value: "",
3208
3224
  children: [],
3209
- attributes: {
3210
- class: "pcb-pad",
3211
- fill: layerNameToColor(pad.layer, colorMap2),
3212
- x: (x - width / 2).toString(),
3213
- y: (y - height / 2).toString(),
3214
- width: width.toString(),
3215
- height: height.toString(),
3216
- rx: radius.toString(),
3217
- ry: radius.toString(),
3218
- "data-type": "pcb_smtpad",
3219
- "data-pcb-layer": pad.layer
3220
- }
3225
+ attributes: baseAttributes
3221
3226
  };
3222
3227
  if (!shouldShowSolderMask) {
3223
3228
  return [padElement];
@@ -3244,23 +3249,25 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3244
3249
  "data-pcb-layer": pad.layer
3245
3250
  }
3246
3251
  };
3252
+ const exposedAttributes = {
3253
+ class: "pcb-pad-exposed",
3254
+ fill: layerNameToColor(pad.layer, colorMap2),
3255
+ x: isRotated ? (-maskWidth / 2).toString() : (x - maskWidth / 2).toString(),
3256
+ y: isRotated ? (-maskHeight / 2).toString() : (y - maskHeight / 2).toString(),
3257
+ width: maskWidth.toString(),
3258
+ height: maskHeight.toString(),
3259
+ rx: maskRadius.toString(),
3260
+ ry: maskRadius.toString(),
3261
+ "data-type": "pcb_soldermask",
3262
+ "data-pcb-layer": pad.layer,
3263
+ ...isRotated && pad.ccw_rotation ? { transform: `translate(${x} ${y}) rotate(${-pad.ccw_rotation})` } : {}
3264
+ };
3247
3265
  const exposedOpeningElement = {
3248
3266
  name: "rect",
3249
3267
  type: "element",
3250
3268
  value: "",
3251
3269
  children: [],
3252
- attributes: {
3253
- class: "pcb-pad-exposed",
3254
- fill: layerNameToColor(pad.layer, colorMap2),
3255
- x: (x - maskWidth / 2).toString(),
3256
- y: (y - maskHeight / 2).toString(),
3257
- width: maskWidth.toString(),
3258
- height: maskHeight.toString(),
3259
- rx: maskRadius.toString(),
3260
- ry: maskRadius.toString(),
3261
- "data-type": "pcb_soldermask",
3262
- "data-pcb-layer": pad.layer
3263
- }
3270
+ attributes: exposedAttributes
3264
3271
  };
3265
3272
  return [coveredPadElement, exposedOpeningElement];
3266
3273
  }
@@ -3285,23 +3292,25 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3285
3292
  };
3286
3293
  return [coveredPadElement];
3287
3294
  }
3295
+ const substrateAttributes = {
3296
+ class: "pcb-soldermask-cutout",
3297
+ fill: colorMap2.substrate,
3298
+ x: isRotated ? (-maskWidth / 2).toString() : (x - maskWidth / 2).toString(),
3299
+ y: isRotated ? (-maskHeight / 2).toString() : (y - maskHeight / 2).toString(),
3300
+ width: maskWidth.toString(),
3301
+ height: maskHeight.toString(),
3302
+ rx: maskRadius.toString(),
3303
+ ry: maskRadius.toString(),
3304
+ "data-type": "pcb_soldermask_opening",
3305
+ "data-pcb-layer": pad.layer,
3306
+ ...isRotated && pad.ccw_rotation ? { transform: `translate(${x} ${y}) rotate(${-pad.ccw_rotation})` } : {}
3307
+ };
3288
3308
  const substrateElement = {
3289
3309
  name: "rect",
3290
3310
  type: "element",
3291
3311
  value: "",
3292
3312
  children: [],
3293
- attributes: {
3294
- class: "pcb-soldermask-cutout",
3295
- fill: colorMap2.substrate,
3296
- x: (x - maskWidth / 2).toString(),
3297
- y: (y - maskHeight / 2).toString(),
3298
- width: maskWidth.toString(),
3299
- height: maskHeight.toString(),
3300
- rx: maskRadius.toString(),
3301
- ry: maskRadius.toString(),
3302
- "data-type": "pcb_soldermask_opening",
3303
- "data-pcb-layer": pad.layer
3304
- }
3313
+ attributes: substrateAttributes
3305
3314
  };
3306
3315
  return [substrateElement, padElement];
3307
3316
  }
@@ -5211,7 +5220,7 @@ function getSoftwareUsedString(circuitJson) {
5211
5220
  var package_default = {
5212
5221
  name: "circuit-to-svg",
5213
5222
  type: "module",
5214
- version: "0.0.280",
5223
+ version: "0.0.281",
5215
5224
  description: "Convert Circuit JSON to SVG",
5216
5225
  main: "dist/index.js",
5217
5226
  files: [