circuit-to-svg 0.0.281 → 0.0.283

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,34 @@ 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 rotationTransformAttributes = isRotated ? {
3206
+ transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
3207
+ } : void 0;
3208
+ const baseAttributes = {
3209
+ class: "pcb-pad",
3210
+ fill: layerNameToColor(pad.layer, colorMap2),
3211
+ x: isRotated ? (-width / 2).toString() : (x - width / 2).toString(),
3212
+ y: isRotated ? (-height / 2).toString() : (y - height / 2).toString(),
3213
+ width: width.toString(),
3214
+ height: height.toString(),
3215
+ rx: radius.toString(),
3216
+ ry: radius.toString(),
3217
+ "data-type": "pcb_smtpad",
3218
+ "data-pcb-layer": pad.layer,
3219
+ ...rotationTransformAttributes ?? {}
3220
+ };
3204
3221
  const padElement = {
3205
3222
  name: "rect",
3206
3223
  type: "element",
3207
3224
  value: "",
3208
3225
  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
- }
3226
+ attributes: baseAttributes
3221
3227
  };
3222
3228
  if (!shouldShowSolderMask) {
3223
3229
  return [padElement];
@@ -3234,33 +3240,36 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3234
3240
  attributes: {
3235
3241
  class: "pcb-pad-covered",
3236
3242
  fill: soldermaskWithCopperUnderneathColor,
3237
- x: (x - width / 2).toString(),
3238
- y: (y - height / 2).toString(),
3243
+ x: isRotated ? (-width / 2).toString() : (x - width / 2).toString(),
3244
+ y: isRotated ? (-height / 2).toString() : (y - height / 2).toString(),
3239
3245
  width: width.toString(),
3240
3246
  height: height.toString(),
3241
3247
  rx: radius.toString(),
3242
3248
  ry: radius.toString(),
3243
3249
  "data-type": "pcb_smtpad",
3244
- "data-pcb-layer": pad.layer
3250
+ "data-pcb-layer": pad.layer,
3251
+ ...rotationTransformAttributes ?? {}
3245
3252
  }
3246
3253
  };
3254
+ const exposedAttributes = {
3255
+ class: "pcb-pad-exposed",
3256
+ fill: layerNameToColor(pad.layer, colorMap2),
3257
+ x: isRotated ? (-maskWidth / 2).toString() : (x - maskWidth / 2).toString(),
3258
+ y: isRotated ? (-maskHeight / 2).toString() : (y - maskHeight / 2).toString(),
3259
+ width: maskWidth.toString(),
3260
+ height: maskHeight.toString(),
3261
+ rx: maskRadius.toString(),
3262
+ ry: maskRadius.toString(),
3263
+ "data-type": "pcb_soldermask",
3264
+ "data-pcb-layer": pad.layer,
3265
+ ...rotationTransformAttributes ?? {}
3266
+ };
3247
3267
  const exposedOpeningElement = {
3248
3268
  name: "rect",
3249
3269
  type: "element",
3250
3270
  value: "",
3251
3271
  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
- }
3272
+ attributes: exposedAttributes
3264
3273
  };
3265
3274
  return [coveredPadElement, exposedOpeningElement];
3266
3275
  }
@@ -3273,35 +3282,38 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
3273
3282
  attributes: {
3274
3283
  class: "pcb-pad-covered",
3275
3284
  fill: soldermaskWithCopperUnderneathColor,
3276
- x: (x - width / 2).toString(),
3277
- y: (y - height / 2).toString(),
3285
+ x: isRotated ? (-width / 2).toString() : (x - width / 2).toString(),
3286
+ y: isRotated ? (-height / 2).toString() : (y - height / 2).toString(),
3278
3287
  width: width.toString(),
3279
3288
  height: height.toString(),
3280
3289
  rx: radius.toString(),
3281
3290
  ry: radius.toString(),
3282
3291
  "data-type": "pcb_smtpad",
3283
- "data-pcb-layer": pad.layer
3292
+ "data-pcb-layer": pad.layer,
3293
+ ...rotationTransformAttributes ?? {}
3284
3294
  }
3285
3295
  };
3286
3296
  return [coveredPadElement];
3287
3297
  }
3298
+ const substrateAttributes = {
3299
+ class: "pcb-soldermask-cutout",
3300
+ fill: colorMap2.substrate,
3301
+ x: isRotated ? (-maskWidth / 2).toString() : (x - maskWidth / 2).toString(),
3302
+ y: isRotated ? (-maskHeight / 2).toString() : (y - maskHeight / 2).toString(),
3303
+ width: maskWidth.toString(),
3304
+ height: maskHeight.toString(),
3305
+ rx: maskRadius.toString(),
3306
+ ry: maskRadius.toString(),
3307
+ "data-type": "pcb_soldermask_opening",
3308
+ "data-pcb-layer": pad.layer,
3309
+ ...rotationTransformAttributes ?? {}
3310
+ };
3288
3311
  const substrateElement = {
3289
3312
  name: "rect",
3290
3313
  type: "element",
3291
3314
  value: "",
3292
3315
  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
- }
3316
+ attributes: substrateAttributes
3305
3317
  };
3306
3318
  return [substrateElement, padElement];
3307
3319
  }
@@ -5211,7 +5223,7 @@ function getSoftwareUsedString(circuitJson) {
5211
5223
  var package_default = {
5212
5224
  name: "circuit-to-svg",
5213
5225
  type: "module",
5214
- version: "0.0.280",
5226
+ version: "0.0.282",
5215
5227
  description: "Convert Circuit JSON to SVG",
5216
5228
  main: "dist/index.js",
5217
5229
  files: [