circuit-to-svg 0.0.282 → 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 +15 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3202,6 +3202,9 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3202
3202
|
const height = pad.height * Math.abs(transform.d);
|
|
3203
3203
|
const radius = pad.radius * Math.abs(transform.a);
|
|
3204
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;
|
|
3205
3208
|
const baseAttributes = {
|
|
3206
3209
|
class: "pcb-pad",
|
|
3207
3210
|
fill: layerNameToColor(pad.layer, colorMap2),
|
|
@@ -3213,9 +3216,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3213
3216
|
ry: radius.toString(),
|
|
3214
3217
|
"data-type": "pcb_smtpad",
|
|
3215
3218
|
"data-pcb-layer": pad.layer,
|
|
3216
|
-
...
|
|
3217
|
-
transform: `translate(${x} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
|
|
3218
|
-
} : {}
|
|
3219
|
+
...rotationTransformAttributes ?? {}
|
|
3219
3220
|
};
|
|
3220
3221
|
const padElement = {
|
|
3221
3222
|
name: "rect",
|
|
@@ -3239,14 +3240,15 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3239
3240
|
attributes: {
|
|
3240
3241
|
class: "pcb-pad-covered",
|
|
3241
3242
|
fill: soldermaskWithCopperUnderneathColor,
|
|
3242
|
-
x: (x - width / 2).toString(),
|
|
3243
|
-
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(),
|
|
3244
3245
|
width: width.toString(),
|
|
3245
3246
|
height: height.toString(),
|
|
3246
3247
|
rx: radius.toString(),
|
|
3247
3248
|
ry: radius.toString(),
|
|
3248
3249
|
"data-type": "pcb_smtpad",
|
|
3249
|
-
"data-pcb-layer": pad.layer
|
|
3250
|
+
"data-pcb-layer": pad.layer,
|
|
3251
|
+
...rotationTransformAttributes ?? {}
|
|
3250
3252
|
}
|
|
3251
3253
|
};
|
|
3252
3254
|
const exposedAttributes = {
|
|
@@ -3260,7 +3262,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3260
3262
|
ry: maskRadius.toString(),
|
|
3261
3263
|
"data-type": "pcb_soldermask",
|
|
3262
3264
|
"data-pcb-layer": pad.layer,
|
|
3263
|
-
...
|
|
3265
|
+
...rotationTransformAttributes ?? {}
|
|
3264
3266
|
};
|
|
3265
3267
|
const exposedOpeningElement = {
|
|
3266
3268
|
name: "rect",
|
|
@@ -3280,14 +3282,15 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3280
3282
|
attributes: {
|
|
3281
3283
|
class: "pcb-pad-covered",
|
|
3282
3284
|
fill: soldermaskWithCopperUnderneathColor,
|
|
3283
|
-
x: (x - width / 2).toString(),
|
|
3284
|
-
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(),
|
|
3285
3287
|
width: width.toString(),
|
|
3286
3288
|
height: height.toString(),
|
|
3287
3289
|
rx: radius.toString(),
|
|
3288
3290
|
ry: radius.toString(),
|
|
3289
3291
|
"data-type": "pcb_smtpad",
|
|
3290
|
-
"data-pcb-layer": pad.layer
|
|
3292
|
+
"data-pcb-layer": pad.layer,
|
|
3293
|
+
...rotationTransformAttributes ?? {}
|
|
3291
3294
|
}
|
|
3292
3295
|
};
|
|
3293
3296
|
return [coveredPadElement];
|
|
@@ -3303,7 +3306,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
3303
3306
|
ry: maskRadius.toString(),
|
|
3304
3307
|
"data-type": "pcb_soldermask_opening",
|
|
3305
3308
|
"data-pcb-layer": pad.layer,
|
|
3306
|
-
...
|
|
3309
|
+
...rotationTransformAttributes ?? {}
|
|
3307
3310
|
};
|
|
3308
3311
|
const substrateElement = {
|
|
3309
3312
|
name: "rect",
|
|
@@ -5220,7 +5223,7 @@ function getSoftwareUsedString(circuitJson) {
|
|
|
5220
5223
|
var package_default = {
|
|
5221
5224
|
name: "circuit-to-svg",
|
|
5222
5225
|
type: "module",
|
|
5223
|
-
version: "0.0.
|
|
5226
|
+
version: "0.0.282",
|
|
5224
5227
|
description: "Convert Circuit JSON to SVG",
|
|
5225
5228
|
main: "dist/index.js",
|
|
5226
5229
|
files: [
|